Fix memory leaks only in tests.

This commit is contained in:
Roger A. Light
2020-05-05 14:19:04 +01:00
parent bfc82ea91a
commit b2e72a7e7c
42 changed files with 57 additions and 0 deletions
+8
View File
@@ -29,6 +29,7 @@ int main(int argc, char *argv[])
print_error("topic", topics, topic_count);
return 1;
}
mosqpp::sub_topic_tokens_free(&topics, topic_count);
if(mosqpp::sub_topic_tokenise("a/deep/topic/hierarchy", &topics, &topic_count)){
printf("Out of memory.\n");
@@ -42,6 +43,7 @@ int main(int argc, char *argv[])
print_error("a/deep/topic/hierarchy", topics, topic_count);
return 1;
}
mosqpp::sub_topic_tokens_free(&topics, topic_count);
if(mosqpp::sub_topic_tokenise("/a/deep/topic/hierarchy", &topics, &topic_count)){
printf("Out of memory.\n");
@@ -56,6 +58,7 @@ int main(int argc, char *argv[])
print_error("/a/deep/topic/hierarchy", topics, topic_count);
return 1;
}
mosqpp::sub_topic_tokens_free(&topics, topic_count);
if(mosqpp::sub_topic_tokenise("a/b/c", &topics, &topic_count)){
printf("Out of memory.\n");
@@ -68,6 +71,7 @@ int main(int argc, char *argv[])
print_error("a/b/c", topics, topic_count);
return 1;
}
mosqpp::sub_topic_tokens_free(&topics, topic_count);
if(mosqpp::sub_topic_tokenise("/a/b/c", &topics, &topic_count)){
printf("Out of memory.\n");
@@ -81,6 +85,7 @@ int main(int argc, char *argv[])
print_error("/a/b/c", topics, topic_count);
return 1;
}
mosqpp::sub_topic_tokens_free(&topics, topic_count);
if(mosqpp::sub_topic_tokenise("a///hierarchy", &topics, &topic_count)){
printf("Out of memory.\n");
@@ -94,6 +99,7 @@ int main(int argc, char *argv[])
print_error("a///hierarchy", topics, topic_count);
return 1;
}
mosqpp::sub_topic_tokens_free(&topics, topic_count);
if(mosqpp::sub_topic_tokenise("/a///hierarchy", &topics, &topic_count)){
printf("Out of memory.\n");
@@ -108,6 +114,7 @@ int main(int argc, char *argv[])
print_error("/a///hierarchy", topics, topic_count);
return 1;
}
mosqpp::sub_topic_tokens_free(&topics, topic_count);
if(mosqpp::sub_topic_tokenise("/a///hierarchy/", &topics, &topic_count)){
printf("Out of memory.\n");
@@ -123,6 +130,7 @@ int main(int argc, char *argv[])
print_error("/a///hierarchy/", topics, topic_count);
return 1;
}
mosqpp::sub_topic_tokens_free(&topics, topic_count);
return 0;
}