From: Christophe Varoqui Date: Fri, 31 Mar 2006 21:00:56 +0000 (+0200) Subject: [multipathd] plug a small leak on "reconfigure" CLI command X-Git-Tag: 0.4.8~146 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=31c986c9eb24a841a633bde624240fa24d7b6686;p=platform%2Fupstream%2Fmultipath-tools.git [multipathd] plug a small leak on "reconfigure" CLI command --- diff --git a/multipathd/main.c b/multipathd/main.c index e33822d..7f2bfa6 100644 --- a/multipathd/main.c +++ b/multipathd/main.c @@ -1022,10 +1022,10 @@ configure (struct vectors * vecs, int start_waiters) vector mpvec; int i; - if (!(vecs->pathvec = vector_alloc())) + if (!vecs->pathvec && !(vecs->pathvec = vector_alloc())) return 1; - if (!(vecs->mpvec = vector_alloc())) + if (!vecs->mpvec && !(vecs->mpvec = vector_alloc())) return 1; if (!(mpvec = vector_alloc())) @@ -1077,6 +1077,7 @@ configure (struct vectors * vecs, int start_waiters) /* * save new set of maps formed by considering current path state */ + vector_free(vecs->mpvec); vecs->mpvec = mpvec; /* @@ -1106,6 +1107,7 @@ reconfigure (struct vectors * vecs) if (VECTOR_SIZE(vecs->pathvec)) free_pathvec(vecs->pathvec, FREE_PATHS); + vecs->pathvec = NULL; conf = NULL; if (load_config(DEFAULT_CONFIGFILE)) @@ -1138,24 +1140,10 @@ init_vecs (void) if (!vecs->lock) goto out; - vecs->pathvec = vector_alloc(); - - if (!vecs->pathvec) - goto out1; - - vecs->mpvec = vector_alloc(); - - if (!vecs->mpvec) - goto out2; - pthread_mutex_init(vecs->lock, NULL); return vecs; -out2: - vector_free(vecs->pathvec); -out1: - FREE(vecs->lock); out: FREE(vecs); condlog(0, "failed to init paths");