Skip to content

Commit

Permalink
Merge pull request #1 from dgryski/linklist-pick-tagged-value-segfault
Browse files Browse the repository at this point in the history
linklist: handle NULL returns from pick_tagged_value()
  • Loading branch information
xant committed Dec 22, 2013
2 parents cb3f2ad + 4a030e9 commit f6cc401
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/linklist.c
Original file line number Diff line number Diff line change
Expand Up @@ -911,6 +911,9 @@ tagged_value_t *get_tagged_value(linked_list_t *list, char *tag)
for(i = 0;i < (int)list_count(list); i++)
{
tval = pick_tagged_value(list, i);
if (!tval) {
continue;
}
if(strcmp(tval->tag, tag) == 0)
return tval;
}
Expand All @@ -934,6 +937,9 @@ uint32_t get_tagged_values(linked_list_t *list, char *tag, linked_list_t *values
for(i = 0;i < (int)list_count(list); i++)
{
tval = pick_tagged_value(list, i);
if (!tval) {
continue;
}
if(strcmp(tval->tag, tag) == 0)
{
push_value(values, tval->value);
Expand Down

0 comments on commit f6cc401

Please sign in to comment.