Skip to content

fix memory leak in lcpa linked list - #16

Open
marenz2569 wants to merge 1 commit into
kismetwireless:masterfrom
marenz2569:fix-linked-list-data-leak
Open

fix memory leak in lcpa linked list#16
marenz2569 wants to merge 1 commit into
kismetwireless:masterfrom
marenz2569:fix-linked-list-data-leak

Conversation

@marenz2569

Copy link
Copy Markdown

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
Copy Markdown

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