Open Source Telephony
 help / color / mirror / Atom feed
From: Marcel Holtmann <marcel@holtmann.org>
To: ofono@ofono.org
Subject: Re: [PATCH 1/2] gatppp: Check ppp instance before unref it
Date: Tue, 06 Jul 2010 09:48:53 -0300	[thread overview]
Message-ID: <1278420533.2789.36.camel@localhost.localdomain> (raw)
In-Reply-To: <1278410258-3077-1-git-send-email-zhenhua.zhang@intel.com>

[-- Attachment #1: Type: text/plain, Size: 697 bytes --]

Hi Zhenhua,

> ---
>  gatchat/gatppp.c |    3 +++
>  1 files changed, 3 insertions(+), 0 deletions(-)
> 
> diff --git a/gatchat/gatppp.c b/gatchat/gatppp.c
> index 1d41ded..d9b1627 100644
> --- a/gatchat/gatppp.c
> +++ b/gatchat/gatppp.c
> @@ -446,6 +446,9 @@ void g_at_ppp_unref(GAtPPP *ppp)
>  {
>  	gboolean is_zero;
>  
> +	if (ppp == NULL)
> +		return;
> +
>  	is_zero = g_atomic_int_dec_and_test(&ppp->ref_count);
>  
>  	if (is_zero == FALSE)

since we have been safe-guarding this in other unref functions as well,
I also applied this patch.

In general the calling code is doing something wrong here if it tries to
unref a NULL pointer.

Regards

Marcel



      parent reply	other threads:[~2010-07-06 12:48 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-07-06  9:57 [PATCH 1/2] gatppp: Check ppp instance before unref it Zhenhua Zhang
2010-07-06  9:57 ` [PATCH 2/2] gathdlc: Unset disconnect function in unref Zhenhua Zhang
2010-07-06 10:03   ` Zhang, Zhenhua
2010-07-06 16:45     ` Denis Kenzior
2010-07-06 16:28   ` Denis Kenzior
2010-07-07  1:32     ` Zhang, Zhenhua
2010-07-06 12:48 ` Marcel Holtmann [this message]

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=1278420533.2789.36.camel@localhost.localdomain \
    --to=marcel@holtmann.org \
    --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