summaryrefslogtreecommitdiffabout
path: root/src
authorSergey Poznyakoff <gray@gnu.org>2016-01-09 07:35:40 (GMT)
committer Sergey Poznyakoff <gray@gnu.org>2016-01-09 07:35:40 (GMT)
commit8434d5e107c0f43847db56569106e2aafb1a67f4 (patch) (side-by-side diff)
tree9236ae5560651770580c81d4497d265bc57f0b89 /src
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') (more/less context) (ignore whitespace changes)
-rw-r--r--src/list.c4
-rw-r--r--src/txtacc.c2
2 files changed, 2 insertions, 4 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;
}
diff --git a/src/txtacc.c b/src/txtacc.c
index 5d42657..810601c 100644
--- a/src/txtacc.c
+++ b/src/txtacc.c
@@ -192,7 +192,7 @@ grecs_txtacc_free_string(struct grecs_txtacc *acc, char *str)
struct grecs_txtacc_entry *tp = ep->data;
if (tp->buf == str) {
grecs_list_remove_entry(acc->mem, ep);
- grecs_free(tp->buf);
+ grecs_txtacc_entry_free(tp);
return;
}
}

Return to:

Send suggestions and report system problems to the System administrator.