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

This commit is contained in:
Richard W.M. Jones
2012-01-24 15:09:02 +00:00
parent d08806adfc
commit 84242a8d0b

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));