chiark / gitweb /
sd-bus: use mfree() in bus_reset_queues()
authorNamhyung Kim <namhyung@gmail.com>
Sat, 1 Aug 2015 15:59:42 +0000 (00:59 +0900)
committerSven Eden <yamakuzure@gmx.net>
Tue, 14 Mar 2017 09:18:46 +0000 (10:18 +0100)
Recently mfree() was introduced to reduce work of tedious free + reset
pointers.  Use it in bus_reset_queues() too.

src/libelogind/sd-bus/sd-bus.c

index 1d60600..68b872e 100644 (file)
@@ -84,15 +84,13 @@ static void bus_reset_queues(sd_bus *b) {
         while (b->rqueue_size > 0)
                 sd_bus_message_unref(b->rqueue[--b->rqueue_size]);
 
-        free(b->rqueue);
-        b->rqueue = NULL;
+        b->rqueue = mfree(b->rqueue);
         b->rqueue_allocated = 0;
 
         while (b->wqueue_size > 0)
                 sd_bus_message_unref(b->wqueue[--b->wqueue_size]);
 
-        free(b->wqueue);
-        b->wqueue = NULL;
+        b->wqueue = mfree(b->wqueue);
         b->wqueue_allocated = 0;
 }