From 481ddab53aae4cd01e8e89418fc7fc37fc434fd6 Mon Sep 17 00:00:00 2001 From: Bastian Dehn Date: Sun, 17 Dec 2017 22:15:10 +0100 Subject: [PATCH] fix: bugfix revert commit: c3a4a8c rervert: change: array with realloc --- discspan.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) 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); -- 2.39.5