Do not re-allocate memory in VoE handler.

This commit is contained in:
Florian Pose 2012-09-20 09:20:51 +02:00
parent 3fedcc24a3
commit 592c2a8cea
1 changed files with 3 additions and 9 deletions

View File

@ -171,16 +171,10 @@ ec_request_state_t ecrt_voe_handler_execute(ec_voe_handler_t *voe)
if (data.size) { // new data waiting to be copied
if (voe->mem_size < data.size) {
if (voe->data)
free(voe->data);
voe->data = malloc(data.size);
if (!voe->data) {
voe->mem_size = 0;
fprintf(stderr, "Failed to allocate VoE data memory!");
fprintf(stderr, "Received %u bytes do not fit info VoE data"
" memory (%u bytes)!\n", data.size, voe->mem_size);
return EC_REQUEST_ERROR;
}
voe->mem_size = data.size;
}
data.data = voe->data;