Skip to contentSkip to conversation

tests/hwtable: fix a memory free in replicate_config

PATCH In review Zhiqiang Liu 2 participants 2 messages Aug 3, 2020 Device mapper

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tests/hwtable: fix a memory free in replicate_config

In replicate_config func, hwtable is allocated by calling get_used_hwes func, however it is not freed.

---
 tests/hwtable.c | 1 +
 1 file changed, 1 insertion(+)
tests/hwtable.c +1 -0
index 473028b7..84d2b35f 100644
@@ -468,6 +468,7 @@ static void replicate_config(const struct hwt_state *hwt, bool local)
 		/* "local" configuration */
 		hwtable = get_used_hwes(hwt->vecs->pathvec);
 		cfg1 = snprint_config(conf, NULL, hwtable, hwt->vecs->mpvec);
+		vector_free(hwtable);
 	}
 
 	assert_non_null(cfg1);
Signature · 1 line
2.24.0.windows.2
maintainer Reviewed-by on v1 1/1
#1 lore raw
Quoted 5 lines · Zhiqiang Liu

In replicate_config func, hwtable is allocated by calling get_used_hwes func, however it is not freed.

Quoted 19 lines
---
 tests/hwtable.c | 1 +
 1 file changed, 1 insertion(+)
tests/hwtable.c +1 -0
index 473028b7..84d2b35f 100644
@@ -468,6 +468,7 @@ static void replicate_config(const struct hwt_state *hwt, bool local)
 		/* "local" configuration */
 		hwtable = get_used_hwes(hwt->vecs->pathvec);
 		cfg1 = snprint_config(conf, NULL, hwtable, hwt->vecs->mpvec);
+		vector_free(hwtable);
 	}
 
 	assert_non_null(cfg1);
Signature · 1 line
2.24.0.windows.2