Fix memory leaks

This commit is contained in:
Amin Ben Romdhane 2024-04-23 16:59:09 +02:00
parent 6b061b56d8
commit 506429fdfe
3 changed files with 10 additions and 2 deletions

View file

@ -86,7 +86,10 @@ static void send_du_state_change_notif(struct blob_attr *msg)
if (tb[1]) {
char *uuid = NULL, *oper = NULL;
CWMP_LOG(INFO, "%s\n", blobmsg_format_json_indent(tb[1], true, -1));
char *str = blobmsg_format_json_indent(tb[1], true, -1);
CWMP_LOG(INFO, "%s\n", str);
FREE(str);
struct blob_attr *tb1[9] = {NULL};
blobmsg_parse(p1, 9, tb1, blobmsg_data(tb[1]), blobmsg_len(tb[1]));
@ -217,7 +220,10 @@ static void send_transfer_complete_notif(struct blob_attr *msg)
if (tb[1]) {
char file_type[256] = {0};
CWMP_LOG(INFO, "%s\n", blobmsg_format_json_indent(tb[1], true, -1));
char *str = blobmsg_format_json_indent(tb[1], true, -1);
CWMP_LOG(INFO, "%s\n", str);
FREE(str);
struct blob_attr *tb1[10] = {NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL};
blobmsg_parse(p1, 6, tb1, blobmsg_data(tb[1]), blobmsg_len(tb[1]));

View file

@ -134,6 +134,7 @@ int download_file_in_subprocess(const char *file_path, const char *url, const ch
if (download_task != NULL) {
char *ret = execute_task_in_subprocess(download_task);
FREE(download_task);
return ret ? atoi(ret) : 500;
}

View file

@ -196,6 +196,7 @@ int upload_file_in_subprocess(const char *file_path, const char *url, const char
if (upload_task != NULL) {
char *ret = execute_task_in_subprocess(upload_task);
FREE(upload_task);
return ret ? atoi(ret) : 500;
}
return 500;