Fix possible memory leak when using a topic that has a leading slash.
Fixes bug #1360986.
This commit is contained in:
parent
57bb64aae1
commit
4a19d9ae3a
@ -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
|
||||
================
|
||||
|
||||
|
18
src/subs.c
18
src/subs.c
@ -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{
|
||||
|
Loading…
Reference in New Issue
Block a user