kill: Fix free() with bad pointer on SIG-prefixed signal-name

kill -l SIGHUP (or any other signal-name prefixed with "SIG")
would cause free() to be called with a bad pointer instead of
a pointer to what was allocated. Fix this and add test-case.
This commit is contained in:
Olof Sivertsson
2016-09-08 08:32:43 +02:00
committed by Craig Small
parent e02d9f554d
commit 95ed10ff43
2 changed files with 5 additions and 1 deletions

View File

@ -263,7 +263,7 @@ char *strtosig(const char *restrict s)
}
}
}
free(p);
free(copy);
return converted;
}