summaryrefslogtreecommitdiffstats
path: root/demux
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2019-07-06 23:45:10 +0200
committerwm4 <wm4@nowhere>2019-09-19 20:37:05 +0200
commit3cea180cc05cbf5f270e171f710f11288a1d2dfe (patch)
tree68df8361b50db89fb55fe618a58ab41633196591 /demux
parenta8be8fe4f48d718b50274146519f1e2080fa80cd (diff)
downloadmpv-3cea180cc05cbf5f270e171f710f11288a1d2dfe.tar.bz2
mpv-3cea180cc05cbf5f270e171f710f11288a1d2dfe.tar.xz
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.
Diffstat (limited to 'demux')
-rw-r--r--demux/packet.c3
1 files changed, 2 insertions, 1 deletions
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;