From: Tollef Fog Heen Date: Thu, 27 Dec 2007 06:47:03 +0000 (+0100) Subject: Make sure newly allocated filter struct is cleared X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c586af045cbf092944b23d5769f3d15f5aba3aa4;p=dpkg 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. --- 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;