Do not re-allocate memory in VoE handler. stable-1.5
authorFlorian Pose <fp@igh-essen.com>
Thu, 20 Sep 2012 09:20:51 +0200
branchstable-1.5
changeset 2432 f4313f5aba88
parent 2431 eee9ed9901f7
child 2433 3bdd7a747fae
Do not re-allocate memory in VoE handler.
lib/voe_handler.c
--- a/lib/voe_handler.c	Thu Sep 20 09:12:03 2012 +0200
+++ b/lib/voe_handler.c	Thu Sep 20 09:20:51 2012 +0200
@@ -171,15 +171,9 @@
 
     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!");
-                return EC_REQUEST_ERROR;
-            }
-            voe->mem_size = data.size;
+            fprintf(stderr, "Received %u bytes do not fit info VoE data"
+                    " memory (%u bytes)!\n", data.size, voe->mem_size);
+            return EC_REQUEST_ERROR;
         }
 
         data.data = voe->data;