adapter: don't use realloc, it does a memcpy

Don't use realloc to grow the scratch area because we don't want the memcpy the
old useless data into the new area before we write our new stuff in it.
This commit is contained in:
Wim Taymans 2009-05-13 23:52:02 +02:00 committed by Wim Taymans
parent 0f83510620
commit b23279e922

View file

@ -402,8 +402,10 @@ gst_adapter_peek (GstAdapter * adapter, guint size)
adapter->assembled_size = (size / DEFAULT_SIZE + 1) * DEFAULT_SIZE;
GST_DEBUG_OBJECT (adapter, "resizing internal buffer to %u",
adapter->assembled_size);
adapter->assembled_data =
g_realloc (adapter->assembled_data, adapter->assembled_size);
/* no g_realloc to avoid a memcpy that is not desired here since we are
* going to copy new data into the area below */
g_free (adapter->assembled_data);
adapter->assembled_data = g_malloc (adapter->assembled_size);
}
adapter->assembled_len = size;