THRIFT-688. Make TBinaryProtocol obey cocoa memory allocation conventions
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@966369 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/lib/cocoa/src/protocol/TBinaryProtocol.m b/lib/cocoa/src/protocol/TBinaryProtocol.m
index 5999e25..b272716 100644
--- a/lib/cocoa/src/protocol/TBinaryProtocol.m
+++ b/lib/cocoa/src/protocol/TBinaryProtocol.m
@@ -37,7 +37,7 @@
}
- (TBinaryProtocol *) newProtocolOnTransport: (id <TTransport>) transport {
- return [[[TBinaryProtocol alloc] initWithTransport: transport] autorelease];
+ return [[TBinaryProtocol alloc] initWithTransport: transport];
}
@end
diff --git a/lib/cocoa/src/server/TSocketServer.m b/lib/cocoa/src/server/TSocketServer.m
index 23b3d10..5f7fa3c 100644
--- a/lib/cocoa/src/server/TSocketServer.m
+++ b/lib/cocoa/src/server/TSocketServer.m
@@ -124,8 +124,8 @@
TNSFileHandleTransport * transport = [[TNSFileHandleTransport alloc] initWithFileHandle: clientSocket];
id<TProcessor> processor = [mProcessorFactory processorForTransport: transport];
- id <TProtocol> inProtocol = [mInputProtocolFactory newProtocolOnTransport: transport];
- id <TProtocol> outProtocol = [mOutputProtocolFactory newProtocolOnTransport: transport];
+ id <TProtocol> inProtocol = [[mInputProtocolFactory newProtocolOnTransport: transport] autorelease];
+ id <TProtocol> outProtocol = [[mOutputProtocolFactory newProtocolOnTransport: transport] autorelease];
@try {
BOOL result = NO;