Browse Source

Fix memory leak

Pierre-Olivier Latour 11 years ago
parent
commit
0dd6d8c5fc
1 changed files with 4 additions and 4 deletions
  1. 4 4
      GCDWebDAVServer/GCDWebDAVServer.m

+ 4 - 4
GCDWebDAVServer/GCDWebDAVServer.m

@@ -409,10 +409,10 @@ static inline xmlNodePtr _XMLChildWithName(xmlNodePtr child, const xmlChar* name
     }
     if (!success) {
       NSString* string = [[NSString alloc] initWithData:request.data encoding:NSUTF8StringEncoding];
-      return [GCDWebServerErrorResponse responseWithClientError:kGCDWebServerHTTPStatusCode_BadRequest message:@"Invalid DAV properties:\n%@", string];
 #if !__has_feature(objc_arc)
-      [string release];
+      [string autorelease];
 #endif
+      return [GCDWebServerErrorResponse responseWithClientError:kGCDWebServerHTTPStatusCode_BadRequest message:@"Invalid DAV properties:\n%@", string];
     }
   } else {
     properties = kDAVAllProperties;
@@ -510,10 +510,10 @@ static inline xmlNodePtr _XMLChildWithName(xmlNodePtr child, const xmlChar* name
   }
   if (!success) {
     NSString* string = [[NSString alloc] initWithData:request.data encoding:NSUTF8StringEncoding];
-    return [GCDWebServerErrorResponse responseWithClientError:kGCDWebServerHTTPStatusCode_BadRequest message:@"Invalid DAV properties:\n%@", string];
 #if !__has_feature(objc_arc)
-    [string release];
+    [string autorelease];
 #endif
+    return [GCDWebServerErrorResponse responseWithClientError:kGCDWebServerHTTPStatusCode_BadRequest message:@"Invalid DAV properties:\n%@", string];
   }
   
   if (![scope isEqualToString:@"exclusive"] || ![type isEqualToString:@"write"] || ![depthHeader isEqualToString:@"0"]) {