From 1bdf51f26fd88dc3f949cef42ee026defc2eb856 Mon Sep 17 00:00:00 2001 From: Love Hornquist Astrand Date: Thu, 30 Jul 2009 10:08:48 +0200 Subject: [PATCH] (strpoolcollect): allow p == NULL, return the empty string (allocated) --- lib/roken/strpool.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/roken/strpool.c b/lib/roken/strpool.c index dc5689214..60eddc633 100644 --- a/lib/roken/strpool.c +++ b/lib/roken/strpool.c @@ -100,7 +100,10 @@ rk_strpoolprintf(struct rk_strpool *p, const char *fmt, ...) char * ROKEN_LIB_FUNCTION rk_strpoolcollect(struct rk_strpool *p) { - char *str = p->str; + char *str; + if (p == NULL) + return strdup(""); + str = = p->str; p->str = NULL; free(p); return str;