Skip to content

Commit

Permalink
[memory] Ensure StringList->next are always initialized to NULL
Browse files Browse the repository at this point in the history
  • Loading branch information
thoni56 committed Jan 22, 2025
1 parent 5ab2892 commit a09e94d
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/options.c
Original file line number Diff line number Diff line change
Expand Up @@ -278,13 +278,15 @@ static StringList *concatStringList(StringList *list, char *string) {
/* Order is important so concat at the end */
if (l == NULL) {
l = optAlloc(sizeof(StringList));
l->next = NULL;
} else {
while (l->next != NULL)
l = l->next;
l->next = optAlloc(sizeof(StringList));
l = l->next;
}
l->string = optAlloc(strlen(string)+1);
l->next = NULL;

strcpy(l->string, string);
return l;
Expand Down

0 comments on commit a09e94d

Please sign in to comment.