From 95708b53e35b7dff1ae4b7b77f672ddc5d4fe293 Mon Sep 17 00:00:00 2001 From: rowanbeentje Date: Sun, 9 May 2010 23:38:43 +0000 Subject: - Check return status when capturing query error message strings - this addresses http://spbug.com/l/250 --- Frameworks/MCPKit/MCPFoundationKit/MCPConnection.m | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'Frameworks/MCPKit') diff --git a/Frameworks/MCPKit/MCPFoundationKit/MCPConnection.m b/Frameworks/MCPKit/MCPFoundationKit/MCPConnection.m index 05d7d42a..5980d377 100644 --- a/Frameworks/MCPKit/MCPFoundationKit/MCPConnection.m +++ b/Frameworks/MCPKit/MCPFoundationKit/MCPConnection.m @@ -1495,7 +1495,8 @@ void performThreadedKeepAlive(void *ptr) // Ensure no problem occurred during the result fetch if (mysql_errno(mConnection) != 0) { - queryErrorMessage = [[NSString alloc] initWithString:[self stringWithCString:mysql_error(mConnection)]]; + queryErrorMessage = [self stringWithCString:mysql_error(mConnection)]; + if (queryErrorMessage) [queryErrorMessage retain]; queryErrorId = mysql_errno(mConnection); break; } @@ -1521,7 +1522,8 @@ void performThreadedKeepAlive(void *ptr) queryErrorId = 1317; } else { if (queryErrorMessage) [queryErrorMessage release], queryErrorMessage = nil; - queryErrorMessage = [[NSString alloc] initWithString:[self stringWithCString:mysql_error(mConnection)]]; + queryErrorMessage = [self stringWithCString:mysql_error(mConnection)]; + if (queryErrorMessage) [queryErrorMessage retain]; queryErrorId = mysql_errno(mConnection); // If the error was a connection error, retry once -- cgit v1.2.3