mirror of https://gitee.com/openkylin/libvirt.git
Avoid use of uninitialized data in virnetmessagetest
If an error occurs in virnetmessagetest it was possible it would free uninitialized data. Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
This commit is contained in:
parent
a93eb09a97
commit
b32ac57ee5
|
@ -327,6 +327,8 @@ static int testMessagePayloadDecode(const void *args ATTRIBUTE_UNUSED)
|
||||||
};
|
};
|
||||||
int ret = -1;
|
int ret = -1;
|
||||||
|
|
||||||
|
memset(&err, 0, sizeof(err));
|
||||||
|
|
||||||
if (!msg)
|
if (!msg)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
|
@ -334,7 +336,6 @@ static int testMessagePayloadDecode(const void *args ATTRIBUTE_UNUSED)
|
||||||
if (VIR_ALLOC_N(msg->buffer, msg->bufferLength) < 0)
|
if (VIR_ALLOC_N(msg->buffer, msg->bufferLength) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
memcpy(msg->buffer, input_buffer, msg->bufferLength);
|
memcpy(msg->buffer, input_buffer, msg->bufferLength);
|
||||||
memset(&err, 0, sizeof(err));
|
|
||||||
|
|
||||||
if (virNetMessageDecodeLength(msg) < 0) {
|
if (virNetMessageDecodeLength(msg) < 0) {
|
||||||
VIR_DEBUG("Failed to decode message header");
|
VIR_DEBUG("Failed to decode message header");
|
||||||
|
|
Loading…
Reference in New Issue