aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMattias Andrée <maandree@operamail.com>2015-12-03 11:15:35 +0100
committerMattias Andrée <maandree@operamail.com>2015-12-03 11:15:35 +0100
commit82c58cc7f94aa05332a9c5dd1d5fc185c46adeb7 (patch)
tree4567984f5cb080ba627a1c4fa8e13e4988cc83ac /src
parentfix bugs (diff)
downloadlibrarian-82c58cc7f94aa05332a9c5dd1d5fc185c46adeb7.tar.gz
librarian-82c58cc7f94aa05332a9c5dd1d5fc185c46adeb7.tar.bz2
librarian-82c58cc7f94aa05332a9c5dd1d5fc185c46adeb7.tar.xz
bug fix
Signed-off-by: Mattias Andrée <maandree@operamail.com>
Diffstat (limited to 'src')
-rw-r--r--src/librarian.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/src/librarian.c b/src/librarian.c
index d788c42..48a09b1 100644
--- a/src/librarian.c
+++ b/src/librarian.c
@@ -755,7 +755,11 @@ int main(int argc, char *argv[])
char *data = NULL;
char *s;
char *end;
+ void** free_this = NULL;
+ size_t free_this_ptr = 0;
+ size_t free_this_size = 0;
const char *deps_string = "deps";
+ void *new;
/* Parse arguments. */
argv0 = argv ? (argc--, *argv++) : "pp";
@@ -830,7 +834,13 @@ int main(int argc, char *argv[])
if (*s && parse_library(s, libraries_last++))
goto not_found;
}
- free(data), data = NULL;
+ if (free_this_ptr == free_this_size) {
+ free_this_size = free_this_size ? (free_this_size << 1) : 4;
+ new = realloc(free_this, free_this_size * sizeof(void*));
+ t (new == NULL);
+ free_this = new;
+ }
+ free_this[free_this_ptr++] = data;
}
}
if (f_locate) {
@@ -862,6 +872,9 @@ cleanup:
while (found_files_count--)
free(found_files[found_files_count].path);
free(found_files);
+ while (free_this_ptr--)
+ free(free_this[free_this_ptr]);
+ free(free_this);
free(libraries);
free(path);
free(data);