From patchwork Mon Jul 25 18:27:00 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benjamin Marzinski X-Patchwork-Id: 1005752 Received: from mx3-phx2.redhat.com (mx3-phx2.redhat.com [209.132.183.24]) by demeter2.kernel.org (8.14.4/8.14.4) with ESMTP id p6PITqFw007888 for ; Mon, 25 Jul 2011 18:30:13 GMT Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by mx3-phx2.redhat.com (8.13.8/8.13.8) with ESMTP id p6PIRc66024176; Mon, 25 Jul 2011 14:27:39 -0400 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id p6PIR71J025442 for ; Mon, 25 Jul 2011 14:27:07 -0400 Received: from ether.msp.redhat.com (ether.msp.redhat.com [10.15.80.119]) by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id p6PIR15a027413 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Mon, 25 Jul 2011 14:27:02 -0400 Received: from ether.msp.redhat.com (localhost.localdomain [127.0.0.1]) by ether.msp.redhat.com (8.14.1/8.14.1) with ESMTP id p6PIR0c1001195 for ; Mon, 25 Jul 2011 13:27:01 -0500 Received: (from bmarzins@localhost) by ether.msp.redhat.com (8.14.1/8.14.1/Submit) id p6PIR0xY001194 for dm-devel@redhat.com; Mon, 25 Jul 2011 13:27:00 -0500 Date: Mon, 25 Jul 2011 13:27:00 -0500 From: Benjamin Marzinski To: device-mapper development Message-ID: <20110725182700.GK15149@ether.msp.redhat.com> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.17 (2007-11-01) X-Scanned-By: MIMEDefang 2.67 on 10.5.11.12 X-loop: dm-devel@redhat.com Subject: [dm-devel] [PATCH] multipath: strdup multipath alias, so that it isn't deleted. X-BeenThere: dm-devel@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk Reply-To: device-mapper development List-Id: device-mapper development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: dm-devel-bounces@redhat.com Errors-To: dm-devel-bounces@redhat.com X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter2.kernel.org [140.211.167.43]); Mon, 25 Jul 2011 18:30:13 +0000 (UTC) When a multipath device is added to multipathd with ev_add_map(), the alias is not duplicated, and is freed immediately after ev_add_map() returns, causing a memory error. This patch corrects that. Signed-off-by: Benjamin Marzinski --- libmultipath/structs_vec.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/libmultipath/structs_vec.c b/libmultipath/structs_vec.c index 189f25b..364e36e 100644 --- a/libmultipath/structs_vec.c +++ b/libmultipath/structs_vec.c @@ -373,7 +373,7 @@ add_map_without_path (struct vectors * vecs, char * alias) if (!mpp || !alias) return NULL; - mpp->alias = alias; + mpp->alias = STRDUP(alias); if (setup_multipath(vecs, mpp)) { mpp->alias = NULL;