From 3b3d1737be0023791e45dfa357b347c832d2a615 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Thu, 5 Apr 2018 12:42:47 +0200 Subject: rfkill: use our usual style for writing destructors Let's accept NULL values gracefully, and let's return NULL. --- src/rfkill/rfkill.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/rfkill') diff --git a/src/rfkill/rfkill.c b/src/rfkill/rfkill.c index bae3aec175..139b4343b0 100644 --- a/src/rfkill/rfkill.c +++ b/src/rfkill/rfkill.c @@ -49,12 +49,12 @@ typedef struct write_queue_item { int state; } write_queue_item; -static void write_queue_item_free(struct write_queue_item *item) -{ - assert(item); +static struct write_queue_item* write_queue_item_free(struct write_queue_item *item) { + if (!item) + return NULL; free(item->file); - free(item); + return mfree(item); } static const char* const rfkill_type_table[NUM_RFKILL_TYPES] = { -- cgit v1.2.3