Skip to content

Conversation

@marenz2569
Copy link

The last element of the linked list in the struct lcpa_metapack will not get freed with the current implementation of lcpa_free. This pull request fixes the resulting memory leak.

@marenz2569 marenz2569 changed the title fix data leak in lcpa linked list fix memory leak in lcpa linked list Nov 7, 2022
@slamm-archkilla
Copy link

void lcpa_free(struct lcpa_metapack *in_head) {
struct lcpa_metapack *cur, *next;

for (cur = in_head; cur != NULL; cur = next) {
    next = cur->next;
    if (cur->freedata)
        free(cur->data);
    free(cur);
}

}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants