summaryrefslogtreecommitdiffstats
path: root/common
diff options
context:
space:
mode:
authorAhmad Fatoum <a.fatoum@pengutronix.de>2021-05-03 13:48:56 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2021-05-12 08:00:00 +0200
commiteecf05d8ced03ab994cd083c7906df434ffd44b7 (patch)
tree846e782500d5ea08dd871595e71be44601741912 /common
parent01a55aa0cbd34ca3740b066ddd22ac7da08a66a7 (diff)
downloadbarebox-eecf05d8ced03ab994cd083c7906df434ffd44b7.tar.gz
barebox-eecf05d8ced03ab994cd083c7906df434ffd44b7.tar.xz
file_list: make freeing a NULL pointer a no-op
This makes code added into usbgadget in a later commit less verbose. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20210503114901.13095-12-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'common')
-rw-r--r--common/file-list.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/common/file-list.c b/common/file-list.c
index 580423aef7..55e6f0e6b6 100644
--- a/common/file-list.c
+++ b/common/file-list.c
@@ -161,6 +161,9 @@ void file_list_free(struct file_list *files)
{
struct file_list_entry *entry, *tmp;
+ if (!files)
+ return;
+
list_for_each_entry_safe(entry, tmp, &files->list, list) {
free(entry->name);
free(entry->filename);