[libsoup] Fix a memory leak in soup_cookie_jar_delete_cookie()
- From: Dan Winship <danw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libsoup] Fix a memory leak in soup_cookie_jar_delete_cookie()
- Date: Tue, 15 Apr 2014 15:20:08 +0000 (UTC)
commit 45605fe6fffe391f47dcbe9bff4ef7ea3e4cc4c7
Author: Joseph Artsimovich <joseph artsimovich youview com>
Date: Wed Apr 9 17:30:35 2014 +0100
Fix a memory leak in soup_cookie_jar_delete_cookie()
A memory leak would happen when asked to delete a matching cookie from
a cookie jar that doesn't contain any matching cookies.
libsoup/soup-cookie-jar.c | 7 ++-----
1 files changed, 2 insertions(+), 5 deletions(-)
---
diff --git a/libsoup/soup-cookie-jar.c b/libsoup/soup-cookie-jar.c
index 8322970..48b5c6c 100644
--- a/libsoup/soup-cookie-jar.c
+++ b/libsoup/soup-cookie-jar.c
@@ -751,16 +751,13 @@ soup_cookie_jar_delete_cookie (SoupCookieJar *jar,
{
SoupCookieJarPrivate *priv;
GSList *cookies, *p;
- char *domain;
g_return_if_fail (SOUP_IS_COOKIE_JAR (jar));
g_return_if_fail (cookie != NULL);
priv = SOUP_COOKIE_JAR_GET_PRIVATE (jar);
- domain = g_strdup (cookie->domain);
-
- cookies = g_hash_table_lookup (priv->domains, domain);
+ cookies = g_hash_table_lookup (priv->domains, cookie->domain);
if (cookies == NULL)
return;
@@ -769,7 +766,7 @@ soup_cookie_jar_delete_cookie (SoupCookieJar *jar,
if (soup_cookie_equal (cookie, c)) {
cookies = g_slist_delete_link (cookies, p);
g_hash_table_insert (priv->domains,
- domain,
+ g_strdup (cookie->domain),
cookies);
soup_cookie_jar_changed (jar, c, NULL);
soup_cookie_free (c);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]