summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStef Walter <stef@thewalter.net>2004-04-07 22:02:34 +0000
committerStef Walter <stef@thewalter.net>2004-04-07 22:02:34 +0000
commita6725d9e37f128a4e4127f6a5032d928d3e9b2ce (patch)
tree1a604df069bad39f310f3d7f03e762779dbc4af8
parent12f359d812dcf7ccbff057f192f49402750375d7 (diff)
Fixed memory leaks
-rw-r--r--common/compat.c9
-rw-r--r--common/compat.h4
-rw-r--r--common/usuals.h1
-rw-r--r--lib/execute.c3
4 files changed, 12 insertions, 5 deletions
diff --git a/common/compat.c b/common/compat.c
index ff8d527..e1bddef 100644
--- a/common/compat.c
+++ b/common/compat.c
@@ -443,13 +443,14 @@ char* strlwr(char *string)
#ifndef HAVE_REALLOCF
+#undef reallocf
-void* reallocf(void* ptr, size_t size)
+void* reallocf(void* pt, size_t sz)
{
- void* ret = realloc(ptr, size);
+ void* ret = realloc(pt, sz);
- if(!ret && size)
- free(ptr);
+ if(!ret && sz)
+ free(pt);
return ret;
}
diff --git a/common/compat.h b/common/compat.h
index 2d16cc4..86a9e04 100644
--- a/common/compat.h
+++ b/common/compat.h
@@ -29,6 +29,10 @@
#endif
#endif
+#ifdef WITH_DMALLOC
+#include "dmalloc.h"
+#endif
+
#ifndef HAVE_STDARG_H
#error ERROR: Must have a working <stdarg.h> header
#else
diff --git a/common/usuals.h b/common/usuals.h
index e263e74..d09fd72 100644
--- a/common/usuals.h
+++ b/common/usuals.h
@@ -57,5 +57,4 @@
#endif
-
#endif //__USUALS_H__20000613
diff --git a/lib/execute.c b/lib/execute.c
index 195d783..0662849 100644
--- a/lib/execute.c
+++ b/lib/execute.c
@@ -1706,6 +1706,9 @@ cleanup:
if(vmStack)
free(vmStack);
+ if(text)
+ free(text);
+
while(stackVars)
{
memory* prev = stackVars->prev;