From c586af045cbf092944b23d5769f3d15f5aba3aa4 Mon Sep 17 00:00:00 2001 From: Tollef Fog Heen Date: Thu, 27 Dec 2007 07:47:03 +0100 Subject: [PATCH] Make sure newly allocated filter struct is cleared To avoid memory corruption, make sure to clear out the new filter struct when it is allocated. --- lib/myopt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/myopt.c b/lib/myopt.c index 5373defe..6defe60a 100644 --- a/lib/myopt.c +++ b/lib/myopt.c @@ -190,6 +190,7 @@ void loadfilter(char *fn) { if (!filter) { ohshite(_("Error allocating memory for filter entry")); } + memset(filter, 0, sizeof(struct filterlist)); if (linebuf[0] == '#' || linebuf[0] == '\n') { continue; @@ -217,7 +218,6 @@ void loadfilter(char *fn) { if (! filters) { filters = filter; filtertail = filter; - filter->next = NULL; } else { filtertail->next = filter; filtertail = filtertail->next; -- 2.39.5