mirror of
git://sourceware.org/git/lvm2.git
synced 2025-03-22 06:50:52 +03:00
lvmcache: free resource on error path
Free allocated svg on error path. Also explicitely ignore dm_strncpy() result. (We know it will end with failure here.)
This commit is contained in:
parent
f90c3d69ce
commit
34bde8b6c7
4
lib/cache/lvmcache.c
vendored
4
lib/cache/lvmcache.c
vendored
@ -325,10 +325,12 @@ void lvmcache_save_vg(struct volume_group *vg, int precommitted)
|
||||
|
||||
dm_list_init(&svg->saved_vg_to_free);
|
||||
|
||||
dm_strncpy(svg->vgid, (const char *)vg->id.uuid, sizeof(svg->vgid));
|
||||
/* Ignore result code, size we intentionally short-cut & pad with 0 */
|
||||
(void) dm_strncpy(svg->vgid, (const char *)vg->id.uuid, sizeof(svg->vgid));
|
||||
|
||||
if (!dm_hash_insert(_saved_vg_hash, svg->vgid, svg)) {
|
||||
log_error("lvmcache: failed to insert saved_vg %s", svg->vgid);
|
||||
dm_free(svg);
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
|
Loading…
x
Reference in New Issue
Block a user