From c3f4ee94a2d62444b8203bdb24ed132133e4667a Mon Sep 17 00:00:00 2001 From: "Roger A. Light" Date: Tue, 30 Jul 2019 15:09:53 +0100 Subject: [PATCH] Set *name to NULL on failure. --- lib/property_mosq.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/property_mosq.c b/lib/property_mosq.c index 76158e584d..d3854cfff3 100644 --- a/lib/property_mosq.c +++ b/lib/property_mosq.c @@ -1064,7 +1064,10 @@ const mosquitto_property *mosquitto_property_read_string_pair(const mosquitto_pr if(value){ *value = calloc(1, p->value.s.len+1); if(!(*value)){ - if(name) free(*name); + if(name){ + free(*name); + *name = NULL; + } return NULL; } memcpy(*value, p->value.s.v, p->value.s.len);