From: Denis Kenzior <denkenz@gmail.com>
To: ofono@ofono.org
Subject: Re: [PATCH QMI LTE v2 08/13] qmi: don't leak cbd and rely on destroy function
Date: Fri, 14 Apr 2017 18:00:47 -0500 [thread overview]
Message-ID: <19cbcb16-3abc-ff2b-aa5b-086ce5d7193e@gmail.com> (raw)
In-Reply-To: <20170414213646.32066-9-jonas@southpole.se>
[-- Attachment #1: Type: text/plain, Size: 1427 bytes --]
Hi Jonas,
On 04/14/2017 04:36 PM, Jonas Bonn wrote:
> ---
> drivers/qmimodem/gprs.c | 5 ++---
> 1 file changed, 2 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/qmimodem/gprs.c b/drivers/qmimodem/gprs.c
> index 05ad4bd..404c975 100644
> --- a/drivers/qmimodem/gprs.c
> +++ b/drivers/qmimodem/gprs.c
> @@ -94,7 +94,7 @@ static void qmi_set_attached(struct ofono_gprs *gprs, int attached,
> ofono_gprs_cb_t cb, void *user_data)
> {
> struct gprs_data *data = ofono_gprs_get_data(gprs);
> - struct cb_data *cbd = cb_data_new(cb, user_data);
> + struct cb_data *cbd;
> struct qmi_param *param;
> uint8_t action;
>
> @@ -109,6 +109,7 @@ static void qmi_set_attached(struct ofono_gprs *gprs, int attached,
> if (!param)
> goto error;
>
> + cbd = cb_data_new(cb, user_data);
> if (qmi_service_send(data->nas, QMI_NAS_ATTACH_DETACH, param,
> attach_detach_cb, cbd, g_free) > 0)
> return;
So cbd is not freed if qmi_service_send fails. So you are introducing a
leak on the fail path.
> @@ -117,8 +118,6 @@ static void qmi_set_attached(struct ofono_gprs *gprs, int attached,
>
> error:
> CALLBACK_WITH_FAILURE(cb, cbd->data);
> -
> - g_free(cbd);
> }
>
> static void get_ss_info_cb(struct qmi_result *result, void *user_data)
>
This entire patch seems unnecessary? The code looks fine as is. Or am
I missing something?
Regards,
-Denis
next prev parent reply other threads:[~2017-04-14 23:00 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-04-14 21:36 [PATCH QMI LTE v2 00/13] QMI LTE series Jonas Bonn
2017-04-14 21:36 ` [PATCH QMI LTE v2 01/13] qmi: duplicate callback data correctly Jonas Bonn
2017-04-14 21:49 ` Denis Kenzior
2017-04-14 21:36 ` [PATCH QMI LTE v2 02/13] qmi: fix typo Jonas Bonn
2017-04-14 21:49 ` Denis Kenzior
2017-04-14 21:36 ` [PATCH QMI LTE v2 03/13] gprs: release active contexts completely Jonas Bonn
2017-04-14 22:13 ` Denis Kenzior
2017-04-14 21:36 ` [PATCH QMI LTE v2 04/13] gprs: _cid_activated is an 'attaching' state Jonas Bonn
2017-04-14 22:29 ` Denis Kenzior
2017-04-14 21:36 ` [PATCH QMI LTE v2 05/13] gprs: set driver_attached when activating automatic contexts Jonas Bonn
2017-04-14 22:43 ` Denis Kenzior
2017-04-14 21:36 ` [PATCH QMI LTE v2 06/13] qmi: implement detach_shutdown method Jonas Bonn
2017-04-14 21:36 ` [PATCH QMI LTE v2 07/13] qmi: read_settings needs to call start network Jonas Bonn
2017-04-14 22:57 ` Denis Kenzior
2017-04-14 21:36 ` [PATCH QMI LTE v2 08/13] qmi: don't leak cbd and rely on destroy function Jonas Bonn
2017-04-14 23:00 ` Denis Kenzior [this message]
2017-04-14 21:36 ` [PATCH QMI LTE v2 09/13] qmi: activate default bearer context for LTE networks Jonas Bonn
2017-04-14 21:36 ` [PATCH QMI LTE v2 10/13] qmi: use destroy callback for activate_primary Jonas Bonn
2017-04-14 21:36 ` [PATCH QMI LTE v2 11/13] qmi: stop listening to packet service notifications Jonas Bonn
2017-04-14 21:36 ` [PATCH QMI LTE v2 12/13] qmi: rely on destroy callback Jonas Bonn
2017-04-14 21:36 ` [PATCH QMI LTE v2 13/13] qmi: consolidate ss_info handling functions Jonas Bonn
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=19cbcb16-3abc-ff2b-aa5b-086ce5d7193e@gmail.com \
--to=denkenz@gmail.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