/pidgin/main: 98995eed6e7b: Fix memory leak at parsing http

Jorge Villase?or salinasv at pidgin.im
Wed Oct 7 00:33:35 EDT 2015


Changeset: 98995eed6e7b50e4092bbfc803b6d9a7b87a6ecf
Author:	 Jorge Villase?or <salinasv at pidgin.im>
Date:	 2015-10-06 21:29 -0700
Branch:	 default
URL: https://hg.pidgin.im/pidgin/main/rev/98995eed6e7b

Description:

Fix memory leak at parsing http

Thanks to AnonymousSubmitter for the pointer.
Fixes #16124

diffstat:

 libpurple/http.c |  4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diffs (21 lines):

diff --git a/libpurple/http.c b/libpurple/http.c
--- a/libpurple/http.c
+++ b/libpurple/http.c
@@ -2870,8 +2870,6 @@ purple_http_url_parse(const char *raw_ur
 
 	g_return_val_if_fail(raw_url != NULL, NULL);
 
-	url = g_new0(PurpleHttpURL, 1);
-
 	if (!g_regex_match(purple_http_re_url, raw_url, 0, &match_info)) {
 		if (purple_debug_is_verbose() && purple_debug_is_unsafe()) {
 			purple_debug_warning("http",
@@ -2881,6 +2879,8 @@ purple_http_url_parse(const char *raw_ur
 		return NULL;
 	}
 
+	url = g_new0(PurpleHttpURL, 1);
+
 	url->protocol = g_match_info_fetch(match_info, 1);
 	host_full = g_match_info_fetch(match_info, 2);
 	url->path = g_match_info_fetch(match_info, 3);



More information about the Commits mailing list