From 646d037b155d98b1bf58d1c7532343a5bed23646 Mon Sep 17 00:00:00 2001 From: Benedikt Heine Date: Sun, 8 Jul 2018 11:25:34 +0200 Subject: [PATCH] Make NULL a valid input for notification_free --- src/notification.c | 4 +++- src/notification.h | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/notification.c b/src/notification.c index 7291758..6d609cc 100644 --- a/src/notification.c +++ b/src/notification.c @@ -204,7 +204,9 @@ void rawimage_free(RawImage *i) /* see notification.h */ void notification_free(notification *n) { - assert(n != NULL); + if (!n) + return; + g_free(n->appname); g_free(n->summary); g_free(n->body); diff --git a/src/notification.h b/src/notification.h index 47500f6..ab21e3c 100644 --- a/src/notification.h +++ b/src/notification.h @@ -119,7 +119,7 @@ void rawimage_free(RawImage *i); /** * Free the memory used by the given notification. * - * @param n: pointer to #notification + * @param n (nullable): pointer to #notification */ void notification_free(notification *n);