From 1c75f53604ebbeffcf5a4129557e958ae6ae2fd3 Mon Sep 17 00:00:00 2001 From: Patrick Ohly Date: Mon, 7 Nov 2016 09:05:40 +0100 Subject: [PATCH] swupd_create_fullfiles: avoid segfault when nothing changes In the (unlikely) case that nothing changed between two builds, get_deduplicated_fullfile_list() segfaults because it uses manifest->files without checking for NULL, aka the empty list. Signed-off-by: Patrick Ohly --- src/fullfiles.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/fullfiles.c b/src/fullfiles.c index 31b9ab5..fcbfc50 100644 --- a/src/fullfiles.c +++ b/src/fullfiles.c @@ -252,7 +252,7 @@ static GList *get_deduplicated_fullfile_list(struct manifest *manifest) manifest->files = g_list_sort(manifest->files, file_sort_hash); list = g_list_first(manifest->files); - while (prev == NULL) { + while (prev == NULL && list != NULL) { tmp = list->data; list = g_list_next(list);