dm_get_name() was creating a vector, populating it with multipaths,
then only deleting the vector itself, which leaked all of the multipaths.
If the number of LUNs (ie. multipaths) was large then the leak was equally large.
Signed-off-by: Konrad Rzeszutek <konrad@virtualiron.com>
{
vector vec;
struct multipath *mpp;
- int i;
+ int i, rc = 0;
vec = vector_alloc();
return 0;
if (dm_get_maps(vec)) {
- vector_free(vec);
- return 0;
+ goto out;
}
vector_foreach_slot(vec, mpp, i) {
if (!strcmp(uuid, mpp->wwid)) {
- vector_free(vec);
strcpy(name, mpp->alias);
- return 1;
+ rc=1;
+ break;
}
}
-
+out:
+ vector_foreach_slot(vec, mpp, i) {
+ free_multipath(mpp, KEEP_PATHS);
+ }
vector_free(vec);
- return 0;
+ return rc;
}
int