From b7fcce08d6121e88d8d1c82e0d535d03c51c1cc6 Mon Sep 17 00:00:00 2001 From: Diego Waxemberg Date: Thu, 8 Jan 2015 23:44:31 -0500 Subject: [PATCH] potentially fixed an intermittent heap corruption --- Limelight/Network/HttpManager.m | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/Limelight/Network/HttpManager.m b/Limelight/Network/HttpManager.m index 4c82c31..96ff96c 100644 --- a/Limelight/Network/HttpManager.m +++ b/Limelight/Network/HttpManager.m @@ -40,6 +40,7 @@ static const NSString* PORT = @"47984"; // Check root status_code if (![HttpManager verifyStatus: rootNode]) { NSLog(@"ERROR: Request returned with failure status"); + xmlFreeDoc(docPtr); return NULL; } @@ -80,8 +81,8 @@ static const NSString* PORT = @"47984"; } node = node->next; } - xmlFree(rootNode); - xmlFree(docPtr); + + xmlFreeDoc(docPtr); return appList; } @@ -98,8 +99,8 @@ static const NSString* PORT = @"47984"; xmlNodePtr rootNode = xmlDocGetRootElement(docPtr); string = [HttpManager getStatusMessage: rootNode]; - xmlFree(rootNode); - xmlFree(docPtr); + + xmlFreeDoc(docPtr); return string; } @@ -118,6 +119,7 @@ static const NSString* PORT = @"47984"; // Check root status_code if (![HttpManager verifyStatus: rootNode]) { NSLog(@"ERROR: Request returned with failure status"); + xmlFreeDoc(docPtr); return NULL; } @@ -134,8 +136,8 @@ static const NSString* PORT = @"47984"; node = node->next; } //NSLog(@"xmlValue: %@", value); - xmlFree(rootNode); - xmlFree(docPtr); + + xmlFreeDoc(docPtr); return value; }