From ded99cd9e986bbd118910056df93ddce2ac698cd Mon Sep 17 00:00:00 2001 From: arno Date: Mon, 29 May 2000 19:42:43 +0000 Subject: [PATCH] * inperror.c: Dynamic allocation through asprintf. --- src/circuit/inperror.c | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/src/circuit/inperror.c b/src/circuit/inperror.c index 995381447..7cfca2957 100644 --- a/src/circuit/inperror.c +++ b/src/circuit/inperror.c @@ -18,7 +18,7 @@ Author: 1985 Thomas L. Quarles char *INPerror(int type) { char *val; - char ebuf[513]; + char *ebuf; val = SPerror(type); @@ -26,14 +26,9 @@ char *INPerror(int type) return (val); if (errRtn) - sprintf(ebuf, "%s detected in routine \"%s\"\n", val, errRtn); + asprintf(&ebuf, "%s detected in routine \"%s\"\n", val, errRtn); else - sprintf(ebuf, "%s\n", val); + asprintf(&ebuf, "%s\n", val); - FREE(val); - val = MALLOC(strlen(ebuf) + 1); - if (val) - strcpy(val, ebuf); - - return (val); + return ebuf; }