From: Tollef Fog Heen Date: Sun, 20 Jan 2008 09:03:45 +0000 (+0100) Subject: Simplify code by using strdup instead of malloc + strcpy. X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=92a78229d2b7ca88ccf1007e627cf9654b44788b;p=dpkg Simplify code by using strdup instead of malloc + strcpy. --- diff --git a/lib/myopt.c b/lib/myopt.c index 064ffeef..a5262c20 100644 --- a/lib/myopt.c +++ b/lib/myopt.c @@ -209,11 +209,10 @@ void loadfilter(char *fn) { continue; } - filter->filterstring = malloc(strlen(linebuf)); + filter->filterstring = strdup(&linebuf[1]); if (!filter->filterstring) { ohshite(_("Error allocating memory for filter entry")); } - strcpy(filter->filterstring, &linebuf[1]); if (! filters) { filters = filter;