/soc/2015/jgeboski/facebook: e0df3850e9c2: facebook: fixed memor...

James Geboski jgeboski at gmail.com
Thu Aug 20 16:53:56 EDT 2015


Changeset: e0df3850e9c222d9ec799914556f513b6c613f68
Author:	 James Geboski <jgeboski at gmail.com>
Date:	 2015-08-20 16:31 -0400
Branch:	 facebook
URL: https://hg.pidgin.im/soc/2015/jgeboski/facebook/rev/e0df3850e9c2

Description:

facebook: fixed memory leak with HTTP error checking

diffstat:

 libpurple/protocols/facebook/api.c |  12 ++++++++----
 1 files changed, 8 insertions(+), 4 deletions(-)

diffs (24 lines):

diff --git a/libpurple/protocols/facebook/api.c b/libpurple/protocols/facebook/api.c
--- a/libpurple/protocols/facebook/api.c
+++ b/libpurple/protocols/facebook/api.c
@@ -625,12 +625,16 @@ fb_api_http_chk(FbApi *api, PurpleHttpCo
 		FB_API_ERROR_EMIT(api, err, return FALSE);
 	}
 
-	if (fb_api_json_chk(api, data, size, root)) {
-		FB_API_ERROR_EMIT(api, err, return FALSE);
-		return TRUE;
+	if (!fb_api_json_chk(api, data, size, root)) {
+		if (G_UNLIKELY(err != NULL)) {
+			g_error_free(err);
+		}
+
+		return FALSE;
 	}
 
-	return FALSE;
+	FB_API_ERROR_EMIT(api, err, return FALSE);
+	return TRUE;
 }
 
 static PurpleHttpConnection *



More information about the Commits mailing list