free_pgvec is always called with free_paths=KEEP_PATHS, except from free_multipath(), which will be fixed in a follow-up patch.
Signed-off-by: Martin Wilck <[email protected]> --- libmultipath/dmparser.c | 4 ++-- libmultipath/pgpolicies.c | 6 +++--- libmultipath/structs.c | 4 ++-- libmultipath/structs.h | 2 +- libmultipath/structs_vec.c | 4 ++-- tests/pgpolicy.c | 2 +- 6 files changed, 11 insertions(+), 11 deletions(-) diff --git a/libmultipath/dmparser.c b/libmultipath/dmparser.c index e0151ed..3411bd0 100644 --- a/libmultipath/dmparser.c +++ b/libmultipath/dmparser.c @@ -205,7 +205,7 @@ int disassemble_map(const struct vector_s *pathvec, return 1; } } else { - free_pgvec(mpp->pg, KEEP_PATHS); + free_pgvec(mpp->pg); mpp->pg = NULL; } @@ -336,7 +336,7 @@ int disassemble_map(const struct vector_s *pathvec, out1: free(word); out: - free_pgvec(mpp->pg, KEEP_PATHS); + free_pgvec(mpp->pg); mpp->pg = NULL; return 1; } diff --git a/libmultipath/pgpolicies.c b/libmultipath/pgpolicies.c index d7302a9..2e1a543 100644 --- a/libmultipath/pgpolicies.c +++ b/libmultipath/pgpolicies.c @@ -256,7 +256,7 @@ out2: out1: free(bitmap); out: - free_pgvec(mp->pg, KEEP_PATHS); + free_pgvec(mp->pg); mp->pg = NULL; return 1; } @@ -316,7 +316,7 @@ int one_path_per_group(struct multipath *mp, vector paths) out1: free_pathgroup(pgp); out: - free_pgvec(mp->pg, KEEP_PATHS); + free_pgvec(mp->pg); mp->pg = NULL; return 1; } @@ -345,7 +345,7 @@ int one_group(struct multipath *mp, vector paths) /* aka multibus */ out1: free_pathgroup(pgp); out: - free_pgvec(mp->pg, KEEP_PATHS); + free_pgvec(mp->pg); mp->pg = NULL; return 1; } diff --git a/libmultipath/structs.c b/libmultipath/structs.c index 059d454..7b5b483 100644 --- a/libmultipath/structs.c +++ b/libmultipath/structs.c @@ -235,7 +235,7 @@ free_pathgroup (struct pathgroup *pgp) } void -free_pgvec (vector pgvec, enum free_path_mode free_paths __attribute__((unused))) +free_pgvec (vector pgvec) { int i; struct pathgroup * pgp; @@ -326,7 +326,7 @@ free_multipath (struct multipath * mpp, enum free_path_mode free_paths) } free_pathvec(mpp->paths, free_paths); - free_pgvec(mpp->pg, free_paths); + free_pgvec(mpp->pg); if (mpp->hwe) { vector_free(mpp->hwe); mpp->hwe = NULL; diff --git a/libmultipath/structs.h b/libmultipath/structs.h index 8fe74c2..3a52c01 100644 --- a/libmultipath/structs.h +++ b/libmultipath/structs.h @@ -577,8 +577,8 @@ void *set_mpp_hwe(struct multipath *mpp, const struct path *pp); void uninitialize_path(struct path *pp); void free_path (struct path *); void free_pathvec (vector vec, enum free_path_mode free_paths); -void free_pgvec (vector pgvec, enum free_path_mode free_paths); void free_pathgroup(struct pathgroup *pgp); +void free_pgvec(vector pgvec); void free_multipath (struct multipath *, enum free_path_mode free_paths); void cleanup_multipath(struct multipath **pmpp); void cleanup_multipath_and_paths(struct multipath **pmpp); diff --git a/libmultipath/structs_vec.c b/libmultipath/structs_vec.c index f3f47d4..c23e754 100644 --- a/libmultipath/structs_vec.c +++ b/libmultipath/structs_vec.c @@ -424,7 +424,7 @@ void remove_map(struct multipath *mpp, vector pathvec) remove_map_callback(mpp); free_pathvec(mpp->paths, KEEP_PATHS); - free_pgvec(mpp->pg, KEEP_PATHS); + free_pgvec(mpp->pg); mpp->paths = mpp->pg = NULL; /* @@ -623,7 +623,7 @@ update_multipath_strings(struct multipath *mpp, vector pathvec) condlog(4, "%s: %s", mpp->alias, __FUNCTION__); free_multipath_attributes(mpp); - free_pgvec(mpp->pg, KEEP_PATHS); + free_pgvec(mpp->pg); mpp->pg = NULL; r = update_multipath_table(mpp, pathvec, 0); diff --git a/tests/pgpolicy.c b/tests/pgpolicy.c index fb956d1..ed050fa 100644 --- a/tests/pgpolicy.c +++ b/tests/pgpolicy.c @@ -131,7 +131,7 @@ static int setup_null(void **state) static int teardownX(struct multipath *mp) { - free_pgvec(mp->pg, KEEP_PATHS); + free_pgvec(mp->pg); mp->pg = NULL; return 0; } -- 2.52.0
