From 3cea180cc05cbf5f270e171f710f11288a1d2dfe Mon Sep 17 00:00:00 2001 From: wm4 Date: Sat, 6 Jul 2019 23:45:10 +0200 Subject: packet: free some unnecessary memory in disk cache case If the disk cache is used, the AVPacket is not used anymore and is completely deallocated when the packet is written to disk. As a minor bug, the AVPacket allocation itself was not freed (although it wasn't a memory leak, since talloc still automatically freed it when the entire demux_packet was freed). For very large caches, this could easily add up to over hundred MB, so actually free the unneeded allocation. --- demux/packet.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/demux/packet.c b/demux/packet.c index 32d799f9ce..d4060c12a2 100644 --- a/demux/packet.c +++ b/demux/packet.c @@ -38,8 +38,9 @@ void demux_packet_unref_contents(struct demux_packet *dp) { if (dp->avpacket) { - av_packet_unref(dp->avpacket); assert(!dp->is_cached); + av_packet_unref(dp->avpacket); + talloc_free(dp->avpacket); dp->avpacket = NULL; dp->buffer = NULL; dp->len = 0; -- cgit v1.2.3