avaudenc: Avoid double-freeing frame's extended data

This occured when attempting to encode 16 channel audio, would crash on the first buffer.
We only need to store ext_data, old ext_data_array (frame->extended_data) is already freed by `av_frame_unref`.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6375>
This commit is contained in:
Piotr Brzeziński 2024-03-14 13:30:24 +01:00 committed by Tim-Philipp Müller
parent 9048bea3d3
commit 4295e1dd30

View file

@ -403,7 +403,7 @@ typedef struct
GstBuffer *buffer;
GstMapInfo map;
guint8 **ext_data_array, *ext_data;
guint8 *ext_data;
} BufferInfo;
static void
@ -416,7 +416,6 @@ buffer_info_free (void *opaque, guint8 * data)
gst_buffer_unref (info->buffer);
} else {
av_freep (&info->ext_data);
av_freep (&info->ext_data_array);
}
g_free (info);
}
@ -473,7 +472,7 @@ gst_ffmpegaudenc_send_frame (GstFFMpegAudEnc * ffmpegaudenc, GstBuffer * buffer)
av_buffer_create (NULL, 0, buffer_info_free, buffer_info, 0);
if (info->channels > AV_NUM_DATA_POINTERS) {
buffer_info->ext_data_array = frame->extended_data =
frame->extended_data =
av_malloc_array (info->channels, sizeof (uint8_t *));
} else {
frame->extended_data = frame->data;