subr_vmem: Fix double-free in error case of vmem_create
If vmem_init() fails, 'vm' is already destroyed and freed. Don't free it again. Reported by: Coverity CID: 1042110 Sponsored by: EMC / Isilon Storage Division
This commit is contained in:
parent
f41be0f076
commit
fe4be618c9
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=299494
@ -1046,10 +1046,8 @@ vmem_create(const char *name, vmem_addr_t base, vmem_size_t size,
|
|||||||
if (vm == NULL)
|
if (vm == NULL)
|
||||||
return (NULL);
|
return (NULL);
|
||||||
if (vmem_init(vm, name, base, size, quantum, qcache_max,
|
if (vmem_init(vm, name, base, size, quantum, qcache_max,
|
||||||
flags) == NULL) {
|
flags) == NULL)
|
||||||
free(vm, M_VMEM);
|
|
||||||
return (NULL);
|
return (NULL);
|
||||||
}
|
|
||||||
return (vm);
|
return (vm);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user