From: Bastian Dehn Date: Sun, 17 Dec 2017 21:15:10 +0000 (+0100) Subject: fix: bugfix revert commit: c3a4a8c X-Git-Url: https://gitweb.hhaalo.de/?a=commitdiff_plain;h=481ddab53aae4cd01e8e89418fc7fc37fc434fd6;p=discspan.git fix: bugfix revert commit: c3a4a8c rervert: change: array with realloc --- diff --git a/discspan.c b/discspan.c index 3307639..c45f04a 100644 --- a/discspan.c +++ b/discspan.c @@ -121,8 +121,7 @@ void filesize_sort(const char *input, const char *output, fseek(in, 0L, SEEK_SET); // struct Array with Dateienanzahl - struct file_size *fs = NULL; - fs = (struct file_size *)malloc((lines - 1) * sizeof(struct file_size)); + struct file_size fs[lines -1]; lines = 0; while(fscanf(in, "%[^\n]\n", pfad) == 1) { @@ -144,9 +143,6 @@ void filesize_sort(const char *input, const char *output, } } - fs = (struct file_size *)realloc(fs, - (lines + 1) * sizeof(struct file_size)); - // sortiere das array fs mit stucts qsort(fs, lines, sizeof(struct file_size), cmpfunc);