mirror of
https://github.com/xenia-project/FFmpeg.git
synced 2024-11-24 12:09:55 +00:00
avpacket: free side data in av_free_packet().
Freeing it in av_destruct_packet(), as is done currently, would mean that we allow it to be allocated with other means. But that would make av_packet_new_side_data() unsafe. Side data is not expected to be large, so copying it if required shouldn't be a problem.
This commit is contained in:
parent
49dc82eef7
commit
90cfc084e3
@ -27,16 +27,9 @@
|
||||
|
||||
void av_destruct_packet(AVPacket *pkt)
|
||||
{
|
||||
int i;
|
||||
|
||||
av_free(pkt->data);
|
||||
pkt->data = NULL;
|
||||
pkt->size = 0;
|
||||
|
||||
for (i = 0; i < pkt->side_data_elems; i++)
|
||||
av_free(pkt->side_data[i].data);
|
||||
av_freep(&pkt->side_data);
|
||||
pkt->side_data_elems = 0;
|
||||
}
|
||||
|
||||
void av_init_packet(AVPacket *pkt)
|
||||
@ -153,11 +146,16 @@ failed_alloc:
|
||||
void av_free_packet(AVPacket *pkt)
|
||||
{
|
||||
if (pkt) {
|
||||
int i;
|
||||
|
||||
if (pkt->destruct)
|
||||
pkt->destruct(pkt);
|
||||
pkt->data = NULL;
|
||||
pkt->size = 0;
|
||||
pkt->side_data = NULL;
|
||||
|
||||
for (i = 0; i < pkt->side_data_elems; i++)
|
||||
av_free(pkt->side_data[i].data);
|
||||
av_freep(&pkt->side_data);
|
||||
pkt->side_data_elems = 0;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user