1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-21 13:34:40 +03:00

lvmlockd: better error path

Set ->num to correct num of pointers.
and fixes regression from previous clang fix
9c5d2874a7.
This commit is contained in:
Zdenek Kabelac 2021-09-18 00:25:33 +02:00
parent a0bbdfba7f
commit 48163e32f1

View File

@ -270,18 +270,13 @@ static void _lockd_retrive_vg_pv_list(struct volume_group *vg,
lock_pvs->path[i] = strdup(pv_dev_name(pvl->pv));
if (!lock_pvs->path[i]) {
log_error("Fail to allocate PV path for VG %s", vg->name);
goto fail;
_lockd_free_pv_list(lock_pvs);
return;
}
log_debug("VG %s find PV device %s", vg->name, lock_pvs->path[i]);
i++;
lock_pvs->num = ++i;
}
lock_pvs->num = pv_num;
return;
fail:
_lockd_free_pv_list(lock_pvs);
}
static int _lockd_retrive_lv_pv_num(struct volume_group *vg,
@ -345,20 +340,15 @@ static void _lockd_retrive_lv_pv_list(struct volume_group *vg,
if (!lock_pvs->path[i]) {
log_error("Fail to allocate PV path for LV %s/%s",
vg->name, lv_name);
goto fail;
_lockd_free_pv_list(lock_pvs);
return;
}
log_debug("Find PV device %s for LV %s/%s",
lock_pvs->path[i], vg->name, lv_name);
i++;
lock_pvs->num = ++i;
}
}
lock_pvs->num = pv_num;
return;
fail:
_lockd_free_pv_list(lock_pvs);
}
/*