From: Kristen Carlson Accardi <kristen@linux.intel.com>
To: ofono@ofono.org
Subject: [PATCH 1/3] fix memory leaks in option handling
Date: Wed, 24 Mar 2010 10:13:23 -0700 [thread overview]
Message-ID: <1269450805-3661-2-git-send-email-kristen@linux.intel.com> (raw)
In-Reply-To: <1269450805-3661-1-git-send-email-kristen@linux.intel.com>
[-- Attachment #1: Type: text/plain, Size: 1589 bytes --]
free the data as well as the link when deleting options lists.
---
gatchat/ppp_cp.c | 15 ++++++++++++++-
1 files changed, 14 insertions(+), 1 deletions(-)
diff --git a/gatchat/ppp_cp.c b/gatchat/ppp_cp.c
index e8d6e30..0f04fa1 100644
--- a/gatchat/ppp_cp.c
+++ b/gatchat/ppp_cp.c
@@ -201,6 +201,16 @@ static void pppcp_clear_options(struct pppcp_data *data)
data->rejected_options = NULL;
}
+static void pppcp_free_options(struct pppcp_data *data)
+{
+ /* remove all config options */
+ pppcp_clear_options(data);
+
+ /* remove default option list */
+ g_list_foreach(data->config_options, pppcp_free_option, NULL);
+ g_list_free(data->config_options);
+}
+
/*
* set the restart counter to either max-terminate
* or max-configure. The counter is decremented for
@@ -1103,6 +1113,7 @@ static void remove_config_option(gpointer elem, gpointer user_data)
if (!list)
return;
+ g_free(list->data);
data->config_options = g_list_delete_link(data->config_options, list);
}
@@ -1226,6 +1237,8 @@ static guint8 pppcp_process_configure_ack(struct pppcp_data *data,
if (action->option_process)
action->option_process(acked_option,
data->priv);
+
+ g_free(list->data);
data->config_options =
g_list_delete_link(data->config_options, list);
} else
@@ -1440,7 +1453,7 @@ void pppcp_free(struct pppcp_data *data)
g_queue_free(data->event_queue);
/* remove all config options */
- pppcp_clear_options(data);
+ pppcp_free_options(data);
/* free self */
g_free(data);
--
1.6.6.1
next prev parent reply other threads:[~2010-03-24 17:13 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-03-24 17:13 [PATCH 0/3] fix memory leaks in PPP Kristen Carlson Accardi
2010-03-24 17:13 ` Kristen Carlson Accardi [this message]
2010-03-24 17:13 ` [PATCH 2/3] fix memory leaks after ppp_transmit Kristen Carlson Accardi
2010-03-24 17:13 ` [PATCH 3/3] fix memory leak in ppp_auth Kristen Carlson Accardi
2010-03-24 20:22 ` [PATCH 0/3] fix memory leaks in PPP Marcel Holtmann
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1269450805-3661-2-git-send-email-kristen@linux.intel.com \
--to=kristen@linux.intel.com \
--cc=ofono@ofono.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox