From 454c5aae4d543f7e9960f666f7156a5e3147225b Mon Sep 17 00:00:00 2001 From: Robert Sesek Date: Wed, 18 Jun 2008 09:47:43 -0400 Subject: [PATCH] Instead of leaking an alloc'd NSString, use an autorelease'd initializer * Source/SocketWrapper.m: (receive:): When building up the full NSString, use the non-alloc-izing initializer --- Source/SocketWrapper.m | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Source/SocketWrapper.m b/Source/SocketWrapper.m index 2e47a05..e74235a 100644 --- a/Source/SocketWrapper.m +++ b/Source/SocketWrapper.m @@ -204,7 +204,7 @@ memmove(packet, &buffer[i], recvd - i); // convert bytes to NSString - [str appendString:[[NSString alloc] initWithCString:packet length:recvd - i]]; + [str appendString:[NSString stringWithCString:packet length:recvd - i]]; // check if we have a partial packet if (length + i > sizeof(buffer)) @@ -217,7 +217,7 @@ [self error:@"Socket closed or could not be read"]; return nil; } - [str appendString:[[NSString alloc] initWithCString:buffer length:latest]]; + [str appendString:[NSString stringWithCString:buffer length:latest]]; recvd += latest; } } -- 2.22.5