daemon: Fix memory leak in 'initrd-cat' (found by valgrind).

(cherry picked from commit 84242a8d0b)
This commit is contained in:
Richard W.M. Jones
2012-01-24 15:09:02 +00:00
parent d2e1e8871e
commit c8e9537e90

View File

@@ -108,9 +108,11 @@ do_initrd_cat (const char *path, const char *filename, size_t *size_r)
int r = system (cmd);
if (r == -1) {
reply_with_perror ("command failed: %s", cmd);
free (cmd);
rmdir (tmpdir);
return NULL;
}
free (cmd);
if (WEXITSTATUS (r) != 0) {
reply_with_perror ("command failed with return code %d",
WEXITSTATUS (r));