diff options
-rw-r--r-- | libavcodec/avcodec.h | 10 | ||||
-rw-r--r-- | libavcodec/avpacket.c | 2 | ||||
-rw-r--r-- | libavformat/utils.c | 2 |
3 files changed, 9 insertions, 5 deletions
diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h index f500151e85..cb64d82f93 100644 --- a/libavcodec/avcodec.h +++ b/libavcodec/avcodec.h @@ -2630,7 +2630,10 @@ typedef struct AVSubtitle { /* packet functions */ -void av_destruct_packet_nofree(AVPacket *pkt); +/** + * @deprecated use NULL instead + */ +attribute_deprecated void av_destruct_packet_nofree(AVPacket *pkt); /** * Default packet destructor. @@ -2675,8 +2678,9 @@ int av_dup_packet(AVPacket *pkt); */ static inline void av_free_packet(AVPacket *pkt) { - if (pkt && pkt->destruct) { - pkt->destruct(pkt); + if (pkt) { + if (pkt->destruct) pkt->destruct(pkt); + pkt->data = NULL; pkt->size = 0; } } diff --git a/libavcodec/avpacket.c b/libavcodec/avpacket.c index d91ee3a10d..194324713f 100644 --- a/libavcodec/avpacket.c +++ b/libavcodec/avpacket.c @@ -42,7 +42,7 @@ void av_init_packet(AVPacket *pkt) pkt->convergence_duration = 0; pkt->flags = 0; pkt->stream_index = 0; - pkt->destruct= av_destruct_packet_nofree; + pkt->destruct= NULL; } int av_new_packet(AVPacket *pkt, int size) diff --git a/libavformat/utils.c b/libavformat/utils.c index d209fe712f..535da98965 100644 --- a/libavformat/utils.c +++ b/libavformat/utils.c @@ -923,7 +923,7 @@ static int av_read_frame_internal(AVFormatContext *s, AVPacket *pkt) pkt->pts = st->parser->pts; pkt->dts = st->parser->dts; pkt->pos = st->parser->pos; - pkt->destruct = av_destruct_packet_nofree; + pkt->destruct = NULL; compute_pkt_fields(s, st, st->parser, pkt); if((s->iformat->flags & AVFMT_GENERIC_INDEX) && pkt->flags & PKT_FLAG_KEY){ |