From e42e9b0e4d3eb8b2c9b5e1791344f211b590040c Mon Sep 17 00:00:00 2001
From: Anton Khirnov <anton@khirnov.net>
Date: Fri, 24 Feb 2012 22:39:19 +0100
Subject: [PATCH] lavc: preserve avpkt->destruct in ff_alloc_packet().

Also, don't bother with saving/restoring data, av_init_packet doesn't
touch it.
---
 libavcodec/utils.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/libavcodec/utils.c b/libavcodec/utils.c
index d797c8a0b73..a91eab1ac11 100644
--- a/libavcodec/utils.c
+++ b/libavcodec/utils.c
@@ -838,14 +838,13 @@ int ff_alloc_packet(AVPacket *avpkt, int size)
         return AVERROR(EINVAL);
 
     if (avpkt->data) {
-        uint8_t *pkt_data;
+        void *destruct = avpkt->destruct;
 
         if (avpkt->size < size)
             return AVERROR(EINVAL);
 
-        pkt_data = avpkt->data;
         av_init_packet(avpkt);
-        avpkt->data = pkt_data;
+        avpkt->destruct = destruct;
         avpkt->size = size;
         return 0;
     } else {
-- 
GitLab