Skip to content

Commit

Permalink
Set *name to NULL on failure.
Browse files Browse the repository at this point in the history
  • Loading branch information
ralight committed Jul 30, 2019
1 parent 46d1208 commit c32715d
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lib/property_mosq.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit c32715d

Please sign in to comment.