diff files.c @ 39:337110e7240a

Pass the size to free; it makes debug checking easier.
author David A. Holland
date Sat, 30 Mar 2013 21:17:47 -0400
parents b156910b59b2
children 2e25e55dba6b
line wrap: on
line diff
--- a/files.c	Sat Mar 30 21:02:25 2013 -0400
+++ b/files.c	Sat Mar 30 21:17:47 2013 -0400
@@ -70,7 +70,7 @@
 void
 incdir_destroy(struct incdir *id)
 {
-	dofree(id);
+	dofree(id, sizeof(*id));
 }
 
 void
@@ -160,8 +160,8 @@
 			}
 			if (bufend >= bufmax) {
 				/* need bigger buffer */
-				bufmax *= 2;
-				buf = dorealloc(buf, bufmax);
+				buf = dorealloc(buf, bufmax, bufmax*2);
+				bufmax = bufmax*2;
 			}
 
 			if (ateof) {
@@ -242,7 +242,7 @@
 	if (toplevel) {
 		directive_goteof(&linestartplace);
 	}
-	dofree(buf);
+	dofree(buf, bufmax);
 }
 
 ////////////////////////////////////////////////////////////
@@ -308,11 +308,11 @@
 		if (fd >= 0) {
 			pf = place_addfile(place, file, id->issystem);
 			file_read(pf, fd, file, false);
-			dofree(file);
+			dostrfree(file);
 			close(fd);
 			return;
 		}
-		dofree(file);
+		dostrfree(file);
 	}
 	complain(place, "Include file %s not found", name);
 	complain_fail();