From cce3553ecec825960739ad3a36e1630da54ce045 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Mon, 18 May 2015 23:23:17 +0200 Subject: [PATCH] resolved: fix crash when shutting down MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Reported by Cristian Rodríguez http://lists.freedesktop.org/archives/systemd-devel/2015-May/031626.html --- src/shared/prioq.c | 6 ++++-- src/shared/prioq.h | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/shared/prioq.c b/src/shared/prioq.c index 8af4c51c2..b89888be0 100644 --- a/src/shared/prioq.c +++ b/src/shared/prioq.c @@ -45,12 +45,14 @@ Prioq *prioq_new(compare_func_t compare_func) { return q; } -void prioq_free(Prioq *q) { +Prioq* prioq_free(Prioq *q) { if (!q) - return; + return NULL; free(q->items); free(q); + + return NULL; } int prioq_ensure_allocated(Prioq **q, compare_func_t compare_func) { diff --git a/src/shared/prioq.h b/src/shared/prioq.h index d836b36cd..1c044b135 100644 --- a/src/shared/prioq.h +++ b/src/shared/prioq.h @@ -28,7 +28,7 @@ typedef struct Prioq Prioq; #define PRIOQ_IDX_NULL ((unsigned) -1) Prioq *prioq_new(compare_func_t compare); -void prioq_free(Prioq *q); +Prioq *prioq_free(Prioq *q); int prioq_ensure_allocated(Prioq **q, compare_func_t compare_func); int prioq_put(Prioq *q, void *data, unsigned *idx); -- 2.30.2