From: Denis Kenzior <denkenz@gmail.com>
To: ofono@ofono.org
Subject: Re: [PATCH] sim: Handle multiple invocations of sim_imsi_obtained
Date: Tue, 06 May 2014 08:38:50 -0500 [thread overview]
Message-ID: <5368E5EA.8070409@gmail.com> (raw)
In-Reply-To: <1399377281-3896-1-git-send-email-slava.monich@jolla.com>
[-- Attachment #1: Type: text/plain, Size: 1178 bytes --]
Hi Slava,
On 05/06/2014 06:54 AM, Slava Monich wrote:
> To avoid leaking memory and issuing unnecessary D-Bus signals
> ---
> src/sim.c | 11 +++++++++--
> 1 file changed, 9 insertions(+), 2 deletions(-)
>
> diff --git a/src/sim.c b/src/sim.c
> index edae5eb..1b0cb80 100644
> --- a/src/sim.c
> +++ b/src/sim.c
> @@ -1425,11 +1425,18 @@ static void sim_set_ready(struct ofono_sim *sim)
>
> static void sim_imsi_obtained(struct ofono_sim *sim, const char *imsi)
> {
> - DBusConnection *conn = ofono_dbus_get_connection();
> - const char *path = __ofono_atom_get_path(sim->atom);
> + DBusConnection *conn;
> + const char *path;
> +
> + if (sim->imsi && !strcmp(sim->imsi, imsi))
> + return;
Calling this function a second time is an error. So this condition
looks highly suspect. What issue are you trying to address?
>
> + DBG("%s", imsi);
> + g_free(sim->imsi);
> sim->imsi = g_strdup(imsi);
>
> + conn = ofono_dbus_get_connection();
> + path = __ofono_atom_get_path(sim->atom);
> ofono_dbus_signal_property_changed(conn, path,
> OFONO_SIM_MANAGER_INTERFACE,
> "SubscriberIdentity",
>
Regards,
-Denis
next prev parent reply other threads:[~2014-05-06 13:38 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-05-06 11:54 [PATCH] sim: Handle multiple invocations of sim_imsi_obtained Slava Monich
2014-05-06 13:38 ` Denis Kenzior [this message]
2014-05-06 14:22 ` Slava Monich
2014-05-06 20:59 ` Denis Kenzior
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=5368E5EA.8070409@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