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
@ -1046,10 +1046,8 @@ vmem_create(const char *name, vmem_addr_t base, vmem_size_t size,
|
||||
if (vm == NULL)
|
||||
return (NULL);
|
||||
if (vmem_init(vm, name, base, size, quantum, qcache_max,
|
||||
flags) == NULL) {
|
||||
free(vm, M_VMEM);
|
||||
flags) == NULL)
|
||||
return (NULL);
|
||||
}
|
||||
return (vm);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user