From 23494c1e2fc8f521d6dcdb7c0ff3f73a21418d2c Mon Sep 17 00:00:00 2001 From: mccallum Date: Tue, 26 Mar 1996 22:28:48 +0000 Subject: [PATCH] ([BinaryCStream -decodeValueOfCType:at:withName:]): [_C_CHARPTR]: Autorelease the malloc'ed char pointer. Before memory was leaking. git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@1277 72102866-910b-0410-8b05-ffd578937521 --- Source/BinaryCStream.m | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Source/BinaryCStream.m b/Source/BinaryCStream.m index 54c2fbf8b..712378a74 100644 --- a/Source/BinaryCStream.m +++ b/Source/BinaryCStream.m @@ -26,6 +26,7 @@ #include #include #include +#include #include #define DEFAULT_FORMAT_VERSION 0 @@ -290,12 +291,13 @@ static BOOL debug_binary_coder; length: NUM_BYTES_STRING_LENGTH]; assert (read_count == NUM_BYTES_STRING_LENGTH); length = ntohl (length); - /* xxx Maybe I should make this alloca() instead of malloc(). */ OBJC_MALLOC (*(char**)d, char, length+1); read_count = [stream readBytes: *(char**)d length: length]; assert (read_count == length); (*(char**)d)[length] = '\0'; + /* Autorelease the newly malloc'ed pointer. */ + [MallocAddress autoreleaseMallocAddress: *(char**)d]; break; }