multipath: strdup multipath alias, so that it isn't deleted
authorBenjamin Marzinski <bmarzins@redhat.com>
Thu, 1 Sep 2011 06:50:54 +0000 (08:50 +0200)
committerChristophe Varoqui <christophe.varoqui@opensvc.com>
Thu, 1 Sep 2011 06:50:54 +0000 (08:50 +0200)
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.

libmultipath/structs_vec.c

index 189f25bbb300e7fa3484987f40c9bc4ba1d20d26..364e36e180f0df4cc538e993ece970a8eefa49df 100644 (file)
@@ -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;