From: Christophe Varoqui Date: Tue, 18 Oct 2005 10:01:02 +0000 (+0200) Subject: [multipath] fix a double free error X-Git-Tag: 0.4.6~59 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=f7dda0660713513bac2589fc16ccb8c77c6dbe63;p=platform%2Fupstream%2Fmultipath-tools.git [multipath] fix a double free error "multipath $FLAGS $ALIAS" code path lead to a double free : 1) get_refwwid did a lookup in mptable and returned mpe->alias as the refwwid 2) in the exit path, we freed refwwid 3) then free_config()->free_mptable()->free_mpe() freed mpe->alias at the same address So return strdup(mpe->alias) instead. --- diff --git a/multipath/main.c b/multipath/main.c index 5a2b2a8..a8e8f41 100644 --- a/multipath/main.c +++ b/multipath/main.c @@ -133,7 +133,7 @@ get_refwwid (vector pathvec) refwwid = get_mpe_wwid(conf->dev); if (refwwid) - return refwwid; + return STRDUP(refwwid); /* * or directly a wwid