chiark / gitweb /
checkpath.c: Match `xmalloc' with `xfree', not `free'.
authorMark Wooding <mdw@distorted.org.uk>
Wed, 17 Jul 2024 11:54:39 +0000 (12:54 +0100)
committerMark Wooding <mdw@distorted.org.uk>
Wed, 17 Jul 2024 11:54:39 +0000 (12:54 +0100)
A library can't reasonably assume that `arena_global' is still
`arena_stdlib'.  Fortunately, we don't retain allocations across calls,
so we don't have to worry about `arena_global' being changed.

checkpath.c

index 5c047a595ebea34a561cd2359ce8dc4baf87502b..4cf5181ddc1d19ce82cb22151ecf5d857090438e 100644 (file)
@@ -139,7 +139,7 @@ static void pop(void)
     struct elt *e = sp->e_link;
     d.len = sp->e_offset;
     DPUTZ(&d);
     struct elt *e = sp->e_link;
     d.len = sp->e_offset;
     DPUTZ(&d);
-    free(sp); sp = e;
+    xfree(sp); sp = e;
   }
 }
 
   }
 }
 
@@ -387,7 +387,7 @@ unsigned checkpath(const char *p, const struct checkpath *cp)
     /* --- Strip off simple `.' elements --- */
 
     if (strcmp(ee->e_name, ".") == 0) {
     /* --- Strip off simple `.' elements --- */
 
     if (strcmp(ee->e_name, ".") == 0) {
-      free(ee);
+      xfree(ee);
       ee = e;
       continue;
     }
       ee = e;
       continue;
     }
@@ -396,7 +396,7 @@ unsigned checkpath(const char *p, const struct checkpath *cp)
 
     else if (strcmp(ee->e_name, "..") == 0) {
       pop();
 
     else if (strcmp(ee->e_name, "..") == 0) {
       pop();
-      free(ee);
+      xfree(ee);
       ee = e;
       continue;
     }
       ee = e;
       continue;
     }
@@ -480,7 +480,7 @@ unsigned checkpath(const char *p, const struct checkpath *cp)
       report(cp, CP_ERROR, 0, 0, "junk left over after reaching leaf");
     while (ee) {
       e = ee->e_link;
       report(cp, CP_ERROR, 0, 0, "junk left over after reaching leaf");
     while (ee) {
       e = ee->e_link;
-      free(ee);
+      xfree(ee);
       ee = e;
     }
   }
       ee = e;
     }
   }