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; }