From e9e41c02d4309cd50b5584a8dfc0d7e01cb27e10 Mon Sep 17 00:00:00 2001 From: dec05eba Date: Wed, 22 Jul 2020 18:48:30 +0200 Subject: Kill child process when parent dies --- src/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/main.c') diff --git a/src/main.c b/src/main.c index e36d912..a9fe9a1 100644 --- a/src/main.c +++ b/src/main.c @@ -1,5 +1,4 @@ #include "../include/parser.h" -#include #include #include #include @@ -38,6 +37,7 @@ static char* file_get_content(const char *filepath, size_t *filesize) { result[*filesize] = '\0'; if((size_t)read(fd, result, *filesize) != *filesize) { free(result); + result = NULL; *filesize = 0; fprintf(stderr, "Error: Failed to read all data from file %s\n", filepath); goto cleanup; -- cgit v1.2.3