main: avoid memory leak

pull/70/head
William Pitcock 2014-06-07 20:19:51 +00:00
parent 912d1d9013
commit 50b647c92f
1 changed files with 6 additions and 2 deletions

8
main.c
View File

@ -62,6 +62,7 @@ fragment_has_system_dir(pkg_fragment_t *frag)
int check_flags = 0; int check_flags = 0;
char *check_paths = NULL; char *check_paths = NULL;
char *save, *chunk; char *save, *chunk;
bool ret = false;
switch (frag->type) 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)) for (chunk = strtok_r(check_paths, ":", &save); chunk != NULL; chunk = strtok_r(NULL, ":", &save))
{ {
if ((want_flags & check_flags) == 0 && !strcmp(chunk, frag->data)) if ((want_flags & check_flags) == 0 && !strcmp(chunk, frag->data))
return true; {
ret = true;
break;
}
} }
free(check_paths); free(check_paths);
return false; return ret;
} }
static void static void