aboutsummaryrefslogtreecommitdiff
path: root/src/list.c
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org>2016-01-09 09:35:40 +0200
committerSergey Poznyakoff <gray@gnu.org>2016-01-09 09:35:40 +0200
commit8434d5e107c0f43847db56569106e2aafb1a67f4 (patch)
tree9236ae5560651770580c81d4497d265bc57f0b89 /src/list.c
parent384b8c088c290f06f70835402f903627c67de6f3 (diff)
downloadgrecs-8434d5e107c0f43847db56569106e2aafb1a67f4.tar.gz
grecs-8434d5e107c0f43847db56569106e2aafb1a67f4.tar.bz2
Fix memory leak
* src/list.c (grecs_list_remove_entry): Free the entry, but not its data. All callers updated. * src/txtacc.c (grecs_txtacc_free_string): Free the txtacc entry after removal.
Diffstat (limited to 'src/list.c')
-rw-r--r--src/list.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/src/list.c b/src/list.c
index e7f69f7..2d57fe0 100644
--- a/src/list.c
+++ b/src/list.c
@@ -82,7 +82,7 @@ grecs_list_remove_entry(struct grecs_list *lp, struct grecs_list_entry *ent)
p->prev = ent->prev;
else
lp->tail = ent->prev;
- ent->next = ent->prev = NULL;
+ grecs_free(ent);
lp->count--;
}
@@ -127,7 +127,6 @@ grecs_list_pop(struct grecs_list *lp)
if (ep) {
data = ep->data;
grecs_list_remove_entry(lp, ep);
- grecs_free(ep);
} else
data = NULL;
return data;
@@ -144,7 +143,6 @@ grecs_list_remove_tail(struct grecs_list *lp)
ep = lp->tail;
data = lp->tail->data;
grecs_list_remove_entry(lp, ep);
- grecs_free(ep);
return data;
}

Return to:

Send suggestions and report system problems to the System administrator.