mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-01-13 21:28:01 +02:00
avcodec/avpacket: always initialize the new packet in avpriv_packet_list_put()
If a copy callback is provided by the caller, the packet passed to it was zeroed instead of initialized with default values. Signed-off-by: James Almer <jamrial@gmail.com>
This commit is contained in:
parent
ffd1316e44
commit
0a029906b2
@ -519,13 +519,14 @@ int avpriv_packet_list_put(PacketList **packet_buffer,
|
|||||||
int (*copy)(AVPacket *dst, const AVPacket *src),
|
int (*copy)(AVPacket *dst, const AVPacket *src),
|
||||||
int flags)
|
int flags)
|
||||||
{
|
{
|
||||||
PacketList *pktl = av_mallocz(sizeof(PacketList));
|
PacketList *pktl = av_malloc(sizeof(PacketList));
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
if (!pktl)
|
if (!pktl)
|
||||||
return AVERROR(ENOMEM);
|
return AVERROR(ENOMEM);
|
||||||
|
|
||||||
if (copy) {
|
if (copy) {
|
||||||
|
get_packet_defaults(&pktl->pkt);
|
||||||
ret = copy(&pktl->pkt, pkt);
|
ret = copy(&pktl->pkt, pkt);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
av_free(pktl);
|
av_free(pktl);
|
||||||
@ -540,6 +541,8 @@ int avpriv_packet_list_put(PacketList **packet_buffer,
|
|||||||
av_packet_move_ref(&pktl->pkt, pkt);
|
av_packet_move_ref(&pktl->pkt, pkt);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pktl->next = NULL;
|
||||||
|
|
||||||
if (*packet_buffer)
|
if (*packet_buffer)
|
||||||
(*plast_pktl)->next = pktl;
|
(*plast_pktl)->next = pktl;
|
||||||
else
|
else
|
||||||
|
Loading…
Reference in New Issue
Block a user