]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
rfkill: use our usual style for writing destructors
authorLennart Poettering <lennart@poettering.net>
Thu, 5 Apr 2018 10:42:47 +0000 (12:42 +0200)
committerLennart Poettering <lennart@poettering.net>
Thu, 5 Apr 2018 10:42:50 +0000 (12:42 +0200)
Let's accept NULL values gracefully, and let's return NULL.

src/rfkill/rfkill.c

index bae3aec175738fed6a43fcb9e63bee7b5eea8047..139b4343b002789f73f11aaee36ef5adecd791f2 100644 (file)
@@ -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] = {