Skip to content

Commit

Permalink
fix memory leak
Browse files Browse the repository at this point in the history
  • Loading branch information
fletcher committed Nov 11, 2015
1 parent 663f0ac commit 01459dd
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion writer.c
Expand Up @@ -373,14 +373,18 @@ link_data * extract_link_data(char *label, scratch_pad *scratch) {
/* matched */
d = ref->link_data;
d = mk_link_data(d->label, d->source, d->title, d->attr);

free(temp);
free(temp2);

return d;
} else {
if (debug)
fprintf(stderr,"a:did not match %s to %s\n",ref->link_data->label, label);
}
ref = ref->next;
}

free(temp);
free(temp2);

Expand All @@ -406,16 +410,19 @@ link_data * extract_link_data(char *label, scratch_pad *scratch) {
/* matched */
d = ref->link_data;
d = mk_link_data(d->label, d->source, d->title, d->attr);

free(temp);

return d;
} else {
if (debug)
fprintf(stderr,"b:did not match %s to %s\n",ref->link_data->label, label);
}
ref = ref->next;
}
free(temp);

free(temp);

if (debug)
fprintf(stderr, "finish extract\n");
return NULL;
Expand Down

0 comments on commit 01459dd

Please sign in to comment.