{
struct blentry_device * ble = MALLOC(sizeof(struct blentry_device));
- if (!ble || !blist)
+ if (!ble)
return 1;
- if (!vector_alloc_slot(blist)) {
+ if (!blist || !vector_alloc_slot(blist)) {
FREE(ble);
return 1;
}
if (!blist)
return 1;
- ble = VECTOR_SLOT(blist, VECTOR_SIZE(blist) - 1);
+ ble = VECTOR_LAST_SLOT(blist);
if (!ble)
return 1;
vector_foreach_slot (blist, ble, i) {
if (ble) {
- regfree(&ble->vendor_reg);
- regfree(&ble->product_reg);
- FREE(ble->vendor);
- FREE(ble->product);
+ if (ble->vendor) {
+ regfree(&ble->vendor_reg);
+ FREE(ble->vendor);
+ }
+ if (ble->product) {
+ regfree(&ble->product_reg);
+ FREE(ble->product);
+ }
FREE(ble);
}
}
if (hwe->prio_name)
FREE(hwe->prio_name);
+ if (hwe->prio_arg)
+ FREE(hwe->prio_arg);
+
if (hwe->bl_product)
FREE(hwe->bl_product);
r = 0;
out:
- if (r)
+ if (r) {
memset(*dmi, 0, sizeof(struct dm_info));
+ FREE(*dmi);
+ *dmi = NULL;
+ }
if (dmt)
dm_task_destroy(dmt);
if (!mpp->pg)
return 1;
- }
+ } else
+ mpp->pg = NULL;
/*
* first pg to try
/* Only call this in multipath client mode */
if (!mpp->waiter && store_path(pathvec, pp))
- goto out;
+ goto out1;
}
FREE(word);
dup = (char *) MALLOC(strlen(str) + 1);
memcpy(dup, str, strlen(str));
- if (!vector_alloc_slot(elements))
+ if (!vector_alloc_slot(elements)) {
+ free_strvec(vec);
goto out1;
+ }
vector_set_slot(elements, dup);
}
pgp->paths = vector_alloc();
- if (!pgp->paths)
+ if (!pgp->paths) {
FREE(pgp);
+ pgp = NULL;
+ }
return pgp;
}
mpp->alias = NULL;
}
- if (mpp->dmi)
+ if (mpp->dmi) {
FREE(mpp->dmi);
+ mpp->dmi = NULL;
+ }
/*
* better own vecs->lock here
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);
mpp->pg = NULL;
mpp->alias = alias;
- if (setup_multipath(vecs, mpp))
+ if (setup_multipath(vecs, mpp)) {
+ mpp->alias = NULL;
return NULL; /* mpp freed in setup_multipath */
+ }
if (adopt_paths(vecs->pathvec, mpp))
goto out;
cmdvec = vector_alloc();
*v = cmdvec;
- if (!cmdvec)
+ if (!cmdvec) {
+ free_strvec(strvec);
return E_NOMEM;
+ }
vector_foreach_slot(strvec, buff, i) {
if (*buff == '"')
r = E_NOPARM;
goto out;
}
+ free_strvec(strvec);
return 0;
out:
if (!h) {
*reply = genhelp_handler();
*len = strlen(*reply) + 1;
+ free_keys(cmdvec);
return 0;
}