From: Michael Tremer Date: Sat, 3 Jul 2021 13:35:12 +0000 (+0000) Subject: solution: Actually terminate the array X-Git-Tag: 0.9.28~1118 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d7a6bb0699f27c2c8cabc585c583a87c3cbcbe7c;p=pakfire.git solution: Actually terminate the array The for loop was off by one Signed-off-by: Michael Tremer --- diff --git a/src/libpakfire/solution.c b/src/libpakfire/solution.c index 9a2f9c4a6..325670ce0 100644 --- a/src/libpakfire/solution.c +++ b/src/libpakfire/solution.c @@ -110,10 +110,6 @@ static char* pakfire_solution_make_string(struct pakfire_solution* solution) { // Allocate memory for all strings char* elements[count + 1]; - // Initialize the array - for (unsigned int i = 0; i < count; i++) - elements[i] = NULL; - // The result string char* s = NULL; @@ -184,6 +180,9 @@ static char* pakfire_solution_make_string(struct pakfire_solution* solution) { elements[i] = element; } + // Terminate the array + elements[count] = NULL; + // All okay, concat result string s = pakfire_string_join(elements, "\n");