]> err.no Git - dpkg/commitdiff
Simplify code by using strdup instead of malloc + strcpy.
authorTollef Fog Heen <tfheen@err.no>
Sun, 20 Jan 2008 09:03:45 +0000 (10:03 +0100)
committerTollef Fog Heen <tfheen@err.no>
Sun, 20 Jan 2008 09:03:45 +0000 (10:03 +0100)
lib/myopt.c

index 064ffeef54f8f4f59c142713c130b82db126cdf0..a5262c203f748d12df1591d4cc475c85f3db2513 100644 (file)
@@ -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;