From e08c954693fdcfceda2de59cca93a76125f4fca6 Mon Sep 17 00:00:00 2001 From: Emmanuele Bassi Date: Fri, 2 Sep 2022 12:52:35 +0100 Subject: [PATCH] Fix check before a memcpy The search_total_results address is always going to be non-zero, so the check will always evaluate to true, and GCC is kind enough to point this out to us. The appropriate fix is checking if the size of the search results array is larger than zero, and if so, copy them into the total results array. --- gio/gdesktopappinfo.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gio/gdesktopappinfo.c b/gio/gdesktopappinfo.c index 85b424dda..56cfa4cdb 100644 --- a/gio/gdesktopappinfo.c +++ b/gio/gdesktopappinfo.c @@ -710,7 +710,7 @@ merge_directory_results (void) static_total_results = g_renew (struct search_result, static_total_results, static_total_results_allocated); } - if (static_total_results + static_total_results_size != 0) + if (static_search_results_size != 0) memcpy (static_total_results + static_total_results_size, static_search_results, static_search_results_size * sizeof (struct search_result));