error.c, ft_sperror(), memory leak, free memory returned by `if_errstring()'

This commit is contained in:
h_vogt 2016-03-28 14:43:35 +02:00 committed by rlar
parent 5611ca4f10
commit efcd8584f1
1 changed files with 3 additions and 1 deletions

View File

@ -53,7 +53,9 @@ fperror(char *mess, int code)
void
ft_sperror(int code, char *mess)
{
fprintf(cp_err, "%s: %s\n", mess, if_errstring(code));
char *errstring = if_errstring(code);
fprintf(cp_err, "%s: %s\n", mess, errstring);
tfree(errstring);
}