aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKalev Lember <kalev@smartlink.ee>2009-04-11 17:55:36 (GMT)
committerKalev Lember <kalev@smartlink.ee>2009-04-11 19:19:33 (GMT)
commit20111dc4e5da4d9f5e2b4ba705181b7647b1377c (patch)
treec53de57cdcffbf12de59bd5f39e692fb7fdca864
parent425355e88d9a8e82379028930d5eca82ac450e5b (diff)
downloadpowwow-20111dc4e5da4d9f5e2b4ba705181b7647b1377c.zip
powwow-20111dc4e5da4d9f5e2b4ba705181b7647b1377c.tar.gz
powwow-20111dc4e5da4d9f5e2b4ba705181b7647b1377c.tar.bz2
cmd.c: Fix a small memory leak in ptrdup2.
The new memory allocated in ptrdup2() did not get freed because it lacked p->signature = PTR_SIG.
-rw-r--r--ChangeLog4
-rw-r--r--ptr.c1
2 files changed, 5 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index 800a043..fbcbb8b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2009-04-11 kalev
+
+ * cmd.c: Fix a small memory leak in ptrdup2.
+
2009-04-08 kalev
* Rename movie.c -> movie_play.c
diff --git a/ptr.c b/ptr.c
index 74e3c69..4c765b5 100644
--- a/ptr.c
+++ b/ptr.c
@@ -64,6 +64,7 @@ ptr ptrdup2 __P2 (ptr,src, int,newmax)
else if (!src)
p = ptrnew(newmax);
else if ((p = malloc(newmax + sizeofptr))) {
+ p->signature = PTR_SIG;
p->max = newmax;
if (newmax > ptrlen(src))
newmax = ptrlen(src);