Skip to content
Snippets Groups Projects
Commit 868b7d82 authored by Deucе's avatar Deucе :ok_hand_tone4:
Browse files

Free copied bbs list entry on return.

Fixes memory leak found by scan-build.
parent 1326b624
Branches
Tags
No related merge requests found
Pipeline #7608 passed
...@@ -2926,6 +2926,7 @@ show_bbslist(char *current, int connected) ...@@ -2926,6 +2926,7 @@ show_bbslist(char *current, int connected)
for (;;) { for (;;) {
if (quitting) { if (quitting) {
free(list); free(list);
free(copied);
return NULL; return NULL;
} }
if (!at_settings) { if (!at_settings) {
...@@ -2933,6 +2934,7 @@ show_bbslist(char *current, int connected) ...@@ -2933,6 +2934,7 @@ show_bbslist(char *current, int connected)
sprintf(list_title, "Directory (%d items)", listcount); sprintf(list_title, "Directory (%d items)", listcount);
if (quitting) { if (quitting) {
free(list); free(list);
free(copied);
return NULL; return NULL;
} }
if (last_mode != cio_api.mode) { if (last_mode != cio_api.mode) {
...@@ -3165,6 +3167,7 @@ show_bbslist(char *current, int connected) ...@@ -3165,6 +3167,7 @@ show_bbslist(char *current, int connected)
false); false);
free_list(&list[0], listcount); free_list(&list[0], listcount);
free(list); free(list);
free(copied);
return &retlist; return &retlist;
} }
} }
...@@ -3177,6 +3180,7 @@ show_bbslist(char *current, int connected) ...@@ -3177,6 +3180,7 @@ show_bbslist(char *current, int connected)
free_list(&list[0], listcount); free_list(&list[0], listcount);
free(list); free(list);
free(copied);
return NULL; return NULL;
case -2: case -2:
nowait = false; nowait = false;
...@@ -3484,6 +3488,7 @@ show_bbslist(char *current, int connected) ...@@ -3484,6 +3488,7 @@ show_bbslist(char *current, int connected)
memcpy(&retlist, list[val], sizeof(struct bbslist)); memcpy(&retlist, list[val], sizeof(struct bbslist));
free_list(&list[0], listcount); free_list(&list[0], listcount);
free(list); free(list);
free(copied);
return &retlist; return &retlist;
} }
} }
...@@ -3591,6 +3596,7 @@ show_bbslist(char *current, int connected) ...@@ -3591,6 +3596,7 @@ show_bbslist(char *current, int connected)
free_list(&list[0], listcount); free_list(&list[0], listcount);
free(list); free(list);
free(copied);
return NULL; return NULL;
case 0: /* Edit default connection settings */ case 0: /* Edit default connection settings */
edit_list(NULL, &defaults, settings.list_path, true); edit_list(NULL, &defaults, settings.list_path, true);
...@@ -3631,6 +3637,7 @@ show_bbslist(char *current, int connected) ...@@ -3631,6 +3637,7 @@ show_bbslist(char *current, int connected)
else if (check_exit(false)) { else if (check_exit(false)) {
free_list(&list[0], listcount); free_list(&list[0], listcount);
free(list); free(list);
free(copied);
return NULL; return NULL;
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment