All of lore.kernel.org
 help / color / mirror / Atom feed
From: zkabelac@sourceware.org <zkabelac@sourceware.org>
To: lvm-devel@redhat.com
Subject: LVM2 ./WHATS_NEW lib/format1/format1.c lib/for ...
Date: 8 Feb 2012 10:49:37 -0000	[thread overview]
Message-ID: <20120208104937.19860.qmail@sourceware.org> (raw)

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	zkabelac at sourceware.org	2012-02-08 10:49:37

Modified files:
	.              : WHATS_NEW 
	lib/format1    : format1.c 
	lib/format_pool: format_pool.c 
	lib/format_text: format-text.c 

Log message:
	Fix resource leaks for failing allocation
	
	In case, something would fail during format initialization,
	return allocated memory.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.2259&r2=1.2260
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/format1/format1.c.diff?cvsroot=lvm2&r1=1.139&r2=1.140
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/format_pool/format_pool.c.diff?cvsroot=lvm2&r1=1.45&r2=1.46
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/format_text/format-text.c.diff?cvsroot=lvm2&r1=1.186&r2=1.187

--- LVM2/WHATS_NEW	2012/02/08 10:46:24	1.2259
+++ LVM2/WHATS_NEW	2012/02/08 10:49:36	1.2260
@@ -1,5 +1,6 @@
 Version 2.02.91 -
 ===================================
+  Fix resource leaks for failing allocation of formats (lvm1/2,pool).
   Release allocated resources in error path for composite_filter_create().
   Do not use lstat() results when failed in _rm_link().
   Remove a "waiting for another thread" log message from dmeventd plugins.
--- LVM2/lib/format1/format1.c	2011/06/01 19:29:32	1.139
+++ LVM2/lib/format1/format1.c	2012/02/08 10:49:36	1.140
@@ -1,6 +1,6 @@
 /*
  * Copyright (C) 2001-2004 Sistina Software, Inc. All rights reserved.
- * Copyright (C) 2004-2007 Red Hat, Inc. All rights reserved.
+ * Copyright (C) 2004-2012 Red Hat, Inc. All rights reserved.
  *
  * This file is part of LVM2.
  *
@@ -587,11 +587,14 @@
 
 	if (!(fmt->labeller = lvm1_labeller_create(fmt))) {
 		log_error("Couldn't create lvm1 label handler.");
+		dm_free(fmt);
 		return NULL;
 	}
 
 	if (!(label_register_handler(FMT_LVM1_NAME, fmt->labeller))) {
 		log_error("Couldn't register lvm1 label handler.");
+		fmt->labeller->ops->destroy(fmt->labeller);
+		dm_free(fmt);
 		return NULL;
 	}
 
--- LVM2/lib/format_pool/format_pool.c	2011/08/10 20:25:30	1.45
+++ LVM2/lib/format_pool/format_pool.c	2012/02/08 10:49:36	1.46
@@ -1,6 +1,6 @@
 /*
  * Copyright (C) 1997-2004 Sistina Software, Inc. All rights reserved.
- * Copyright (C) 2004-2006 Red Hat, Inc. All rights reserved.
+ * Copyright (C) 2004-2012 Red Hat, Inc. All rights reserved.
  *
  * This file is part of LVM2.
  *
@@ -298,11 +298,14 @@
 
 	if (!(fmt->labeller = pool_labeller_create(fmt))) {
 		log_error("Couldn't create pool label handler.");
+		dm_free(fmt);
 		return NULL;
 	}
 
 	if (!(label_register_handler(FMT_POOL_NAME, fmt->labeller))) {
 		log_error("Couldn't register pool label handler.");
+		fmt->labeller->ops->destroy(fmt->labeller);
+		dm_free(fmt);
 		return NULL;
 	}
 
--- LVM2/lib/format_text/format-text.c	2011/11/18 19:31:10	1.186
+++ LVM2/lib/format_text/format-text.c	2012/02/08 10:49:36	1.187
@@ -1,6 +1,6 @@
 /*
  * Copyright (C) 2001-2004 Sistina Software, Inc. All rights reserved.
- * Copyright (C) 2004-2007 Red Hat, Inc. All rights reserved.
+ * Copyright (C) 2004-2012 Red Hat, Inc. All rights reserved.
  *
  * This file is part of LVM2.
  *
@@ -2362,14 +2362,13 @@
 
 	if (!(fmt->labeller = text_labeller_create(fmt))) {
 		log_error("Couldn't create text label handler.");
-		dm_free(fmt);
-		return NULL;
+		goto err;
 	}
 
 	if (!(label_register_handler(FMT_TEXT_NAME, fmt->labeller))) {
 		log_error("Couldn't register text label handler.");
-		dm_free(fmt);
-		return NULL;
+		fmt->labeller->ops->destroy(fmt->labeller);
+		goto err;
 	}
 
 	if ((cn = find_config_tree_node(cmd, "metadata/dirs"))) {
@@ -2402,8 +2401,7 @@
 	return fmt;
 
       err:
-	_free_dirs(&mda_lists->dirs);
+	_text_destroy(fmt);
 
-	dm_free(fmt);
 	return NULL;
 }



             reply	other threads:[~2012-02-08 10:49 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-02-08 10:49 zkabelac [this message]
  -- strict thread matches above, loose matches on Subject: below --
2012-02-27 11:23 LVM2 ./WHATS_NEW lib/format1/format1.c lib/for zkabelac
2012-02-13 11:04 zkabelac
2012-02-13 10:56 zkabelac
2011-03-11 15:10 prajnoha
2011-03-11 14:50 prajnoha
2011-03-11 14:38 prajnoha
2011-03-11 14:30 prajnoha
2010-10-05 17:34 wysochanski
2009-07-30 17:45 snitzer
2009-04-10  9:59 mbroz
2009-02-25 23:29 mbroz
2009-02-25 23:47 ` Alasdair G Kergon

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=20120208104937.19860.qmail@sourceware.org \
    --to=zkabelac@sourceware.org \
    --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.