diff options
author | Panu Matilainen <pmatilai@redhat.com> | 2008-04-29 17:09:07 +0300 |
---|---|---|
committer | Panu Matilainen <pmatilai@redhat.com> | 2008-04-29 17:39:02 +0300 |
commit | aaa7fa0f943817d344fab0a95340744f6acebf9d (patch) | |
tree | 0fafeff7987fcb5441088202feabeedd8627eda1 /build/parsePreamble.c | |
parent | 485d19548834a68db3c57082b6bdc57fa58cf5f8 (diff) | |
download | librpm-tizen-aaa7fa0f943817d344fab0a95340744f6acebf9d.tar.gz librpm-tizen-aaa7fa0f943817d344fab0a95340744f6acebf9d.tar.bz2 librpm-tizen-aaa7fa0f943817d344fab0a95340744f6acebf9d.zip |
Plug memleak in parseSimplePart()
Diffstat (limited to 'build/parsePreamble.c')
-rw-r--r-- | build/parsePreamble.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/build/parsePreamble.c b/build/parsePreamble.c index 114790c76..167622810 100644 --- a/build/parsePreamble.c +++ b/build/parsePreamble.c @@ -71,28 +71,32 @@ static int parseSimplePart(const char *line, char **name, int *flag) { char *tok; char *linebuf = xstrdup(line); + int rc; /* Throw away the first token (the %xxxx) */ (void)strtok(linebuf, " \t\n"); *name = NULL; if (!(tok = strtok(NULL, " \t\n"))) { - free(linebuf); - return 0; + rc = 0; + goto exit; } if (!strcmp(tok, "-n")) { if (!(tok = strtok(NULL, " \t\n"))) { - free(linebuf); - return 1; + rc = 1; + goto exit; } *flag = PART_NAME; } else { *flag = PART_SUBNAME; } *name = xstrdup(tok); + rc = strtok(NULL, " \t\n") ? 1 : 0; - return (strtok(NULL, " \t\n")) ? 1 : 0; +exit: + free(linebuf); + return rc; } /** |