All of lore.kernel.org
 help / color / mirror / Atom feed
From: Denis Kenzior <denkenz@gmail.com>
To: ofono@ofono.org
Subject: Re: [PATCH] Fix a memory leak, all dir opened with opendir must be closed with closedir
Date: Wed, 11 May 2011 13:35:27 -0500	[thread overview]
Message-ID: <4DCAD6EF.30600@gmail.com> (raw)
In-Reply-To: <1305127663-6173-1-git-send-email-bertrand.aygon@intel.com>

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

Hi Bertrand,

On 05/11/2011 10:27 AM, Bertrand Aygon wrote:
> ---
>  plugins/nokia-gpio.c |    7 +++++--
>  1 files changed, 5 insertions(+), 2 deletions(-)
> 
> diff --git a/plugins/nokia-gpio.c b/plugins/nokia-gpio.c
> index 3ddf6e1..57aad8d 100644
> --- a/plugins/nokia-gpio.c
> +++ b/plugins/nokia-gpio.c
> @@ -645,7 +645,6 @@ static int gpio_probe_links(void)
>  	DBG("Using %s: trying to make links to %s", gpiodir, cmtdir);
>  
>  	if (!dir_exists(cmtdir)) {
> -
>  		if (mkdir(cmtdir, 0755) == -1) {
>  			DBG("%s: %s", cmtdir, strerror(errno));
>  			return -(errno = ENODEV);

Since this is a style issue, I broke your patch up into two.

> @@ -663,8 +662,10 @@ static int gpio_probe_links(void)
>  		FILE *nf;
>  		size_t len;
>  
> -		if (d == NULL)
> +		if (d == NULL) {
> +			(void) closedir(gpio);
>  			return 0;
> +		}
>  
>  		snprintf(nn, sizeof nn, "%s/%s/name", gpiodir, d->d_name);
>  
> @@ -701,6 +702,8 @@ static int gpio_probe_links(void)
>  
>  	DBG("%s: %s", "/sys/class/gpio", strerror(errno));
>  
> +	(void) closedir(gpio);
> +
>  	return -(errno = ENODEV);
>  }
>  

Patch has been applied with a modified commit message.  Thanks.

Regards,
-Denis

      reply	other threads:[~2011-05-11 18:35 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-11 15:27 [PATCH] Fix a memory leak, all dir opened with opendir must be closed with closedir Bertrand Aygon
2011-05-11 18:35 ` Denis Kenzior [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=4DCAD6EF.30600@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.