* inperror.c: Dynamic allocation through asprintf.

This commit is contained in:
arno 2000-05-29 19:42:43 +00:00
parent 12da5de1cc
commit ded99cd9e9
1 changed files with 4 additions and 9 deletions

View File

@ -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;
}