Fix possible memory leak when using a topic that has a leading slash.

Fixes bug #1360986.
This commit is contained in:
Roger A. Light 2014-10-05 21:24:08 +01:00
parent 57bb64aae1
commit 4a19d9ae3a
2 changed files with 21 additions and 4 deletions

View File

@ -1,3 +1,10 @@
1.3.5 - 20141005
================
Broker:
- Fix possible memory leak when using a topic that has a leading slash. Fixes
bug #1360985.
1.3.4 - 20140806
================

View File

@ -155,8 +155,13 @@ static int _sub_topic_tokenise(const char *subtopic, struct _sub_token **topics)
new_topic->topic = _mosquitto_strdup("");
if(!new_topic->topic) goto cleanup;
*topics = new_topic;
tail = new_topic;
if(tail){
tail->next = new_topic;
tail = tail->next;
}else{
*topics = new_topic;
tail = new_topic;
}
}
len = strlen(subtopic);
@ -168,8 +173,13 @@ static int _sub_topic_tokenise(const char *subtopic, struct _sub_token **topics)
new_topic->topic = _mosquitto_strdup("");
if(!new_topic->topic) goto cleanup;
*topics = new_topic;
tail = new_topic;
if(tail){
tail->next = new_topic;
tail = tail->next;
}else{
*topics = new_topic;
tail = new_topic;
}
start = 1;
}else{