mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-23 16:50:47 +00:00
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:
parent
0f83510620
commit
b23279e922
1 changed files with 4 additions and 2 deletions
|
@ -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;
|
||||
|
||||
|
|
Loading…
Reference in a new issue