OSDN Git Service

fix leak memory on makedefs
authorSHIRAKATA Kentaro <argrath@ub32.org>
Sun, 12 May 2019 17:19:41 +0000 (02:19 +0900)
committerSHIRAKATA Kentaro <argrath@ub32.org>
Sat, 1 Jun 2019 12:52:53 +0000 (21:52 +0900)
This should not be mostly harmful.

util/makedefs.c

index ad89fe9..405868c 100644 (file)
@@ -1900,10 +1900,13 @@ do_data()
         }
         if (*line > ' ') { /* got an entry name */
 #else
-            unsigned char uc;
-            uc = *((unsigned char *)line);
-            if (d_filter(line)) continue;
-            if (uc > ' ') { /* got an entry name */
+        unsigned char uc;
+        if (d_filter(line)) {
+            free(line);
+            continue;
+        }
+        uc = *((unsigned char *)line);
+        if (uc > ' ') { /* got an entry name */
 #endif
             /* first finish previous entry */
             if (line_cnt)