mirror of
https://github.com/gnif/LookingGlass.git
synced 2024-11-25 06:47:19 +00:00
[host] app: prevent possible null deref and resource leak
This commit is contained in:
parent
b14aad7118
commit
96b5892c31
@ -595,6 +595,14 @@ static bool appendData(KVMFRUserData * dst, const void * src, const size_t size)
|
|||||||
|
|
||||||
static bool newKVMFRData(KVMFRUserData * dst)
|
static bool newKVMFRData(KVMFRUserData * dst)
|
||||||
{
|
{
|
||||||
|
dst->data = malloc(1024);
|
||||||
|
if (!dst->data)
|
||||||
|
{
|
||||||
|
DEBUG_ERROR("Out of memory");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
dst->size = 1024;
|
||||||
|
|
||||||
{
|
{
|
||||||
KVMFR kvmfr =
|
KVMFR kvmfr =
|
||||||
{
|
{
|
||||||
@ -669,7 +677,7 @@ static bool lgmpSetup(struct IVSHMEM * shmDev)
|
|||||||
{
|
{
|
||||||
KVMFRUserData udata = { 0 };
|
KVMFRUserData udata = { 0 };
|
||||||
if (!newKVMFRData(&udata))
|
if (!newKVMFRData(&udata))
|
||||||
return false;
|
goto fail_init;
|
||||||
|
|
||||||
LGMP_STATUS status;
|
LGMP_STATUS status;
|
||||||
if ((status = lgmpHostInit(shmDev->mem, shmDev->size, &app.lgmp,
|
if ((status = lgmpHostInit(shmDev->mem, shmDev->size, &app.lgmp,
|
||||||
|
Loading…
Reference in New Issue
Block a user