index : pacman | |
Archlinux32 fork of pacman | gitolite user |
summaryrefslogtreecommitdiff |
author | Rikard Falkeborn <rikard.falkeborn@gmail.com> | 2015-08-10 21:42:37 +0200 |
---|---|---|
committer | Allan McRae <allan@archlinux.org> | 2015-10-21 15:06:25 +1000 |
commit | 19d373c9b95ff5c9ee6d5a4cdb097670f69068d4 (patch) | |
tree | 88dae876f5e5986f5800036e4e70053fa92509a5 /src/util/pacsort.c | |
parent | 4b3df10d5d53af94475e006c71ed262efcab6f0f (diff) |
-rw-r--r-- | src/util/pacsort.c | 6 |
diff --git a/src/util/pacsort.c b/src/util/pacsort.c index b0137ec4..003ec073 100644 --- a/src/util/pacsort.c +++ b/src/util/pacsort.c @@ -254,7 +254,10 @@ static char *explode(struct buffer_t *buffer, struct list_t *list) while((end = memchr(ptr, linedelim, &buffer->mem[buffer->len] - ptr))) { *end = '\0'; meta = input_new(ptr, end - ptr); - list_add(list, meta); + if(meta == NULL || list_add(list, meta) != 0) { + input_free(meta); + return NULL; + } ptr = end + 1; } @@ -294,6 +297,7 @@ static int splitfile(FILE *stream, struct buffer_t *buffer, struct list_t *list) if(buffer->len) { struct input_t *meta = input_new(buffer->mem, buffer->len + 1); if(meta == NULL || list_add(list, meta) != 0) { + input_free(meta); return 1; } } |