When either curmp or pathvec couldn't be allocated we never
free up the other one, too.
Found by coverity.

Signed-off-by: Hannes Reinecke <[email protected]>
---
 libmpathpersist/mpath_persist.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/libmpathpersist/mpath_persist.c b/libmpathpersist/mpath_persist.c
index c4b8521..cfc2f0f 100644
--- a/libmpathpersist/mpath_persist.c
+++ b/libmpathpersist/mpath_persist.c
@@ -195,6 +195,10 @@ int mpath_persistent_reserve_in (int fd, int rq_servact,
        if (!curmp || !pathvec){
                condlog (0, "%s: vector allocation failed.", alias);
                ret = MPATH_PR_DMMP_ERROR;
+               if (curmp)
+                       vector_free(curmp);
+               if (pathvec)
+                       vector_free(pathvec);
                goto out;
        }
 
@@ -285,6 +289,10 @@ int mpath_persistent_reserve_out ( int fd, int rq_servact, 
int rq_scope,
        if (!curmp || !pathvec){
                condlog (0, "%s: vector allocation failed.", alias);
                ret = MPATH_PR_DMMP_ERROR;
+               if (curmp)
+                       vector_free(curmp);
+               if (pathvec)
+                       vector_free(pathvec);
                goto out;
        }
 
-- 
2.6.6

--
dm-devel mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/dm-devel

Reply via email to