Skip to content

Perform null check before free #433

Description

@cruzzil

static struct stringlist* stringlist_delete(struct stringlist* slist) {
if (slist != NULL) {
size_t i=0;
if (slist->data != NULL) {
for (i=0; i < slist->size; i++) {
free(slist->data[i]);
}
}
free(slist->data);
free(slist);
}
return NULL;
}

Line 308, probably want to null check before attempting to free.

Also the free(slist->data); should be inside the conditional block.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions