All of lore.kernel.org
 help / color / mirror / Atom feed
From: Zdenek Kabelac <zkabelac@redhat.com>
To: lvm-devel@redhat.com
Subject: Re: [PATCH 1/4] Fix coredump and memory leak for 'dmsetup help -c'
Date: Thu, 10 Dec 2009 14:33:04 +0100	[thread overview]
Message-ID: <hfqtag$mgi$1@ger.gmane.org> (raw)
In-Reply-To: <fc67f51ffd717cb4b6a70e96e5b18ea9d55ae42d.1260449368.git.zkabelac@redhat.com>

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Dne 10.12.2009 13:53, Zdenek Kabelac napsal(a):
> Signed-off-by: Zdenek Kabelac <zkabelac@redhat.com>
> ---
>  tools/dmsetup.c |    6 ++++--
>  1 files changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/tools/dmsetup.c b/tools/dmsetup.c
> index 888edff..b5568f0 100644
> --- a/tools/dmsetup.c
> +++ b/tools/dmsetup.c
> @@ -2402,7 +2402,7 @@ static int _report_init(struct command *c)
>  	size_t len = 0;
>  	int r = 0;
>  
> -	if (!strcmp(c->name, "splitname"))
> +	if (c && !strcmp(c->name, "splitname"))
>  		options = (char *) splitname_report_options;
>  
>  	/* emulate old dmsetup behaviour */
> @@ -2591,7 +2591,9 @@ static int _help(int argc __attribute((unused)),
>  		_switches[OPTIONS_ARG] = 1;
>  		_string_args[OPTIONS_ARG] = (char *) "help";
>  		_switches[SORT_ARG] = 0;
> -	
> +
> +		if (_report)
> +			dm_report_free(_report);
>  		(void) _report_init(NULL);
>  	}
>  

To stay safe even in case of memory failure inside of _report_init:
- --
- -	
+
+		if (_report) {
+			dm_report_free(_report);
+			_report = NULL;
+		}
- --

Zdenek


-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.13 (GNU/Linux)
Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org/

iQIcBAEBAgAGBQJLIPiQAAoJEBiFrTh9QvFuPIwQALCWEqesTlha+wVDWzXY4We5
Xr6DRXZwYZpFQJS8fJWceOiU1QBHAArPizrpASLWLnC4vvVjqP4vAk+ifSE5mktz
qEDu+rSbJW2GBvEsyo2C3dm3tIqvd9GN7Z5OQ8ECgLqdqeN+oz4WUf8Jk/s5RYvI
Y8eIC2UVrPEEE0MjGgogPc5nH8mrBr27IPmqa7TXOLFht9RajTfcJkFlrilVnaSs
vLPpj2w4xWMcNzqHDlvV+AHU92KZA8fFq72dgzNEsRuXFxpfMKMXALT9pMLE1oAv
5KOMWdSsG+qtoyr3Ivb1YFQUgHdOLhLJIz0RbTd51K6NH8NIdmCxeuyjCBErS/Yo
L5AbO6VlhNyx7BWwFaOP6s3MVBkLgmo62KsAy1cJoBqFc/KbgSvZLWNbnwP0DqkS
jHZ4vhEU907A+99h1HM0Oze40ngNqUbSIunA+/pyKuqCjDjYoQNYMPHNYaZCMHb7
rS/r+RWU5zJAqXipXXD0YbMEb0CFRJqjTQ4YTUoIVULZ5hNRKOs2dO0ARh/C8lx/
lLy2eRz1ROb8GR4De76bCec4TUVBQSoqqLXwBU2Jy/XLw3vZB+ve66VYXBtoqsj1
4hbjSOzqduixO2mL7Ll3KQVJL66ocKmLOgNlbLJcgLYJwPw9Pw/bvxvk4VZ8eS2H
mAF1XWnA8IavteF8wVlF
=7rFB
-----END PGP SIGNATURE-----



  reply	other threads:[~2009-12-10 13:33 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-12-10 12:53 [PATCH 0/4] Fixes and cleanups Zdenek Kabelac
2009-12-10 12:53 ` [PATCH 1/4] Fix coredump and memory leak for 'dmsetup help -c' Zdenek Kabelac
2009-12-10 13:33   ` Zdenek Kabelac [this message]
2009-12-10 12:53 ` [PATCH 2/4] Fix unlocking for vgrelease for error paths Zdenek Kabelac
2009-12-10 12:53 ` [PATCH 3/4] Skip 'return' keyword for void() functions Zdenek Kabelac
2009-12-10 12:54 ` [PATCH 4/4] Call dm_pool_destroy on allocation error path Zdenek Kabelac
2009-12-11 10:37 ` [PATCH 0/4] Fixes and cleanups Milan Broz

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='hfqtag$mgi$1@ger.gmane.org' \
    --to=zkabelac@redhat.com \
    --cc=lvm-devel@redhat.com \
    /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.