diff options
author | Ahmad Fatoum <a.fatoum@pengutronix.de> | 2021-05-03 13:48:56 +0200 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2021-05-12 08:00:00 +0200 |
commit | eecf05d8ced03ab994cd083c7906df434ffd44b7 (patch) | |
tree | 846e782500d5ea08dd871595e71be44601741912 /common | |
parent | 01a55aa0cbd34ca3740b066ddd22ac7da08a66a7 (diff) | |
download | barebox-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.c | 3 |
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); |