adapter: use g_realloc for resizing the buffer

Use g_realloc for resizing the internal buffer instead of a
less fancy _free/_malloc pair.
This commit is contained in:
Wim Taymans 2009-05-13 22:51:18 +02:00 committed by Wim Taymans
parent bb013081a4
commit cc7985ab48

View file

@ -398,12 +398,12 @@ gst_adapter_peek (GstAdapter * adapter, guint size)
}
/* Gonna need to copy stuff out */
if (adapter->assembled_size < size) {
if (G_UNLIKELY (adapter->assembled_size < size)) {
adapter->assembled_size = (size / DEFAULT_SIZE + 1) * DEFAULT_SIZE;
GST_DEBUG_OBJECT (adapter, "setting size of internal buffer to %u",
GST_DEBUG_OBJECT (adapter, "resizing internal buffer to %u",
adapter->assembled_size);
g_free (adapter->assembled_data);
adapter->assembled_data = g_malloc (adapter->assembled_size);
adapter->assembled_data =
g_realloc (adapter->assembled_data, adapter->assembled_size);
}
adapter->assembled_len = size;