From 50b647c92fa4f244b002c67c8b2a63fb8b10462e Mon Sep 17 00:00:00 2001 From: William Pitcock Date: Sat, 7 Jun 2014 20:19:51 +0000 Subject: [PATCH] main: avoid memory leak --- main.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/main.c b/main.c index 0df1407..3503923 100644 --- a/main.c +++ b/main.c @@ -62,6 +62,7 @@ fragment_has_system_dir(pkg_fragment_t *frag) int check_flags = 0; char *check_paths = NULL; char *save, *chunk; + bool ret = false; switch (frag->type) { @@ -80,12 +81,15 @@ fragment_has_system_dir(pkg_fragment_t *frag) for (chunk = strtok_r(check_paths, ":", &save); chunk != NULL; chunk = strtok_r(NULL, ":", &save)) { if ((want_flags & check_flags) == 0 && !strcmp(chunk, frag->data)) - return true; + { + ret = true; + break; + } } free(check_paths); - return false; + return ret; } static void