[multipath] fix a double free error
authorChristophe Varoqui <root@xa-s05.(none)>
Tue, 18 Oct 2005 10:01:02 +0000 (12:01 +0200)
committerChristophe Varoqui <root@xa-s05.(none)>
Tue, 18 Oct 2005 10:01:02 +0000 (12:01 +0200)
"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.

multipath/main.c

index 5a2b2a8..a8e8f41 100644 (file)
@@ -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