mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-22 05:35:25 +00:00
Avoid crash on OOM in virnetmessagetest
The virnetmessagetest code did not check for failure to allocate the message object. This lead to a crash on OOM in the test suite. Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
This commit is contained in:
parent
5e67ed4215
commit
a93eb09a97
@ -327,6 +327,9 @@ static int testMessagePayloadDecode(const void *args ATTRIBUTE_UNUSED)
|
||||
};
|
||||
int ret = -1;
|
||||
|
||||
if (!msg)
|
||||
return -1;
|
||||
|
||||
msg->bufferLength = 4;
|
||||
if (VIR_ALLOC_N(msg->buffer, msg->bufferLength) < 0)
|
||||
goto cleanup;
|
||||
@ -476,6 +479,9 @@ static int testMessagePayloadStreamEncode(const void *args ATTRIBUTE_UNUSED)
|
||||
};
|
||||
int ret = -1;
|
||||
|
||||
if (!msg)
|
||||
return -1;
|
||||
|
||||
msg->header.prog = 0x11223344;
|
||||
msg->header.vers = 0x01;
|
||||
msg->header.proc = 0x666;
|
||||
|
Loading…
Reference in New Issue
Block a user