Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: memory leaks #2454

Merged
merged 4 commits into from
Dec 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion other/bootstrap_daemon/docker/tox-bootstrapd.sha256
Original file line number Diff line number Diff line change
@@ -1 +1 @@
e0e1c3f1ba835f76faca9383b606ed1a5b778bd79caae9a1e3bb4bf3bfaed19a /usr/local/bin/tox-bootstrapd
949fc78e9b46da0ea6929c64263767b563012cc1ea0205fb89466422477326ab /usr/local/bin/tox-bootstrapd
1 change: 1 addition & 0 deletions other/bootstrap_daemon/src/tox-bootstrapd.c
Original file line number Diff line number Diff line change
Expand Up @@ -375,6 +375,7 @@ int main(int argc, char *argv[])

if (!onion) {
log_write(LOG_LEVEL_ERROR, "Couldn't initialize Tox Onion. Exiting.\n");
kill_gca(group_announce);
kill_announcements(announce);
kill_forwarding(forwarding);
kill_dht(dht);
Expand Down
13 changes: 10 additions & 3 deletions other/fun/save-generator.c
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,15 @@ static void print_information(Tox *tox)
int length = snprintf(nospam_str, sizeof(nospam_str), "%08X", nospam);
nospam_str[length] = '\0';

uint8_t *name = (uint8_t *)malloc(tox_self_get_name_size(tox) + 1);
assert(name != nullptr);
size_t name_size = tox_self_get_name_size(tox);
uint8_t *name = (uint8_t *)malloc(name_size + 1);

if (!name) {
return;
}

tox_self_get_name(tox, name);
name[tox_self_get_name_size(tox)] = '\0';
name[name_size] = '\0';

printf("INFORMATION\n");
printf("----------------------------------\n");
Expand All @@ -86,6 +91,8 @@ static void print_information(Tox *tox)
printf("Status message: %s.\n", GENERATED_STATUS_MESSAGE);
printf("Number of friends: %zu.\n", tox_self_get_friend_list_size(tox));
printf("----------------------------------\n");

free(name);
}

int main(int argc, char *argv[])
Expand Down
1 change: 1 addition & 0 deletions toxcore/group_connection.c
Original file line number Diff line number Diff line change
Expand Up @@ -453,6 +453,7 @@ int gcc_handle_packet_fragment(const GC_Session *c, GC_Chat *chat, uint32_t peer
gconn = get_gc_connection(chat, peer_number);

if (gconn == nullptr) {
free(payload);
return 0;
}

Expand Down