diff options
author | Seonah Moon <seonah1.moon@samsung.com> | 2019-10-16 14:07:20 +0900 |
---|---|---|
committer | Seonah Moon <seonah1.moon@samsung.com> | 2019-10-16 14:07:25 +0900 |
commit | 7e83c2dd89bc4fcbbc823eaa53a335013dbd4343 (patch) | |
tree | 783195c31f8c69b5987160e8140626a741b8df04 | |
parent | 518b79eadcc3eb8d61568185465ceb48d3073c9a (diff) | |
download | libsoup-7e83c2dd89bc4fcbbc823eaa53a335013dbd4343.tar.gz libsoup-7e83c2dd89bc4fcbbc823eaa53a335013dbd4343.tar.bz2 libsoup-7e83c2dd89bc4fcbbc823eaa53a335013dbd4343.zip |
soup-server: fix a leak in server handlerstizen_5.5.m2_releasesubmit/tizen_5.5_wearable_hotfix/20201026.184307submit/tizen_5.5_mobile_hotfix/20201026.185107submit/tizen_5.5/20191031.000007submit/tizen/20191016.074433accepted/tizen/unified/20191017.105800accepted/tizen/5.5/unified/wearable/hotfix/20201027.095805accepted/tizen/5.5/unified/mobile/hotfix/20201027.073444accepted/tizen/5.5/unified/20191031.010710tizen_5.5_wearable_hotfixtizen_5.5_tvtizen_5.5_mobile_hotfixaccepted/tizen_5.5_unified_wearable_hotfixaccepted/tizen_5.5_unified_mobile_hotfixaccepted/tizen_5.5_unified
If a SoupServer handler specified a GDestroyNotify, it would only get
run when explicitly removing the handler, not when freeing the server.
Fix.
https://gitlab.gnome.org/GNOME/libsoup/commit/37c8e71c0e4a080207575b9a16a632fe6e6071b0
Change-Id: I4de7b2ebc7e31a70d8c4c5d269af33b1767f9f1a
-rw-r--r-- | libsoup/soup-server.c | 22 | ||||
-rw-r--r-- | packaging/libsoup.spec | 2 |
2 files changed, 5 insertions, 19 deletions
diff --git a/libsoup/soup-server.c b/libsoup/soup-server.c index 07d801d1..c6b8ab2f 100644 --- a/libsoup/soup-server.c +++ b/libsoup/soup-server.c @@ -137,6 +137,8 @@ static void free_handler (SoupServerHandler *hand) { g_free (hand->path); + if (hand->destroy) + hand->destroy (hand->user_data); g_slice_free (SoupServerHandler, hand); } @@ -1456,13 +1458,6 @@ soup_server_add_handler (SoupServer *server, priv->default_handler = hand; } -static void -unregister_handler (SoupServerHandler *handler) -{ - if (handler->destroy) - handler->destroy (handler->user_data); -} - /** * soup_server_remove_handler: * @server: a #SoupServer @@ -1474,23 +1469,14 @@ void soup_server_remove_handler (SoupServer *server, const char *path) { SoupServerPrivate *priv; - SoupServerHandler *hand; g_return_if_fail (SOUP_IS_SERVER (server)); priv = SOUP_SERVER_GET_PRIVATE (server); if (!path || !*path || !strcmp (path, "/")) { - if (priv->default_handler) { - unregister_handler (priv->default_handler); - free_handler (priv->default_handler); - priv->default_handler = NULL; - } + g_clear_pointer (&priv->default_handler, free_handler); return; - } - - hand = soup_path_map_lookup (priv->handlers, path); - if (hand && !strcmp (path, hand->path)) { - unregister_handler (hand); + } else { soup_path_map_remove (priv->handlers, path); } } diff --git a/packaging/libsoup.spec b/packaging/libsoup.spec index daeb7634..9aceed29 100644 --- a/packaging/libsoup.spec +++ b/packaging/libsoup.spec @@ -3,7 +3,7 @@ Name: libsoup Version: 2.46.0 -Release: 0 +Release: 1 License: LGPL-2.0+ Summary: HTTP client/server library for GNOME Url: http://www.gnome.org |