Index: src/OFString.m ================================================================== --- src/OFString.m +++ src/OFString.m @@ -31,12 +31,11 @@ if (str == NULL) { length = 0; string = NULL; } else { length = strlen(str); - if ((string = [self getMem: length + 1]) == NULL) - return NULL; + string = [self getMem: length + 1]; memcpy(string, str, length + 1); } } return self; } Index: src/OFWideString.m ================================================================== --- src/OFWideString.m +++ src/OFWideString.m @@ -32,13 +32,11 @@ if (wstr == NULL) { length = 0; wstring = NULL; } else { length = wcslen(wstr); - if (NULL == (wstring = - [self getMem: (length + 1) * sizeof(wchar_t)])) - return NULL; + wstring = [self getMem: (length + 1) * sizeof(wchar_t)]; memcpy(wstring, wstr, (length + 1) * sizeof(wchar_t)); } } return self; } Index: tests/OFObject/OFObject.m ================================================================== --- tests/OFObject/OFObject.m +++ tests/OFObject/OFObject.m @@ -37,11 +37,11 @@ void *p, *q, *r; /* Test freeing memory not allocated by obj */ puts("Freeing memory not allocated by object (should throw an " "exception)..."); - CATCH_EXCEPTION([obj freeMem: (void*)123], OFMemNotPartOfObjException) + CATCH_EXCEPTION([obj freeMem: NULL], OFMemNotPartOfObjException) /* Test allocating memory */ puts("Allocating memory through object..."); p = [obj getMem: 4096]; puts("Allocated 4096 bytes.");