From 8b675dacad1c43e952f9dea827c84bfa69502782 Mon Sep 17 00:00:00 2001
From: Min Chen <[email protected]>
Date: Wed, 7 Sep 2016 15:38:48 -0500
Subject: [PATCH] [slice] fix memory leak in weight module
---
source/encoder/reference.cpp | 7 +++++++
1 files changed, 7 insertions(+), 0 deletions(-)
diff --git a/source/encoder/reference.cpp b/source/encoder/reference.cpp
index 437ea8b..864ca63 100644
--- a/source/encoder/reference.cpp
+++ b/source/encoder/reference.cpp
@@ -54,6 +54,13 @@ int MotionReference::init(PicYuv* recPic, WeightParam *wp,
const x265_param& p)
lumaStride = recPic->m_stride;
chromaStride = recPic->m_strideC;
numInterpPlanes = p.subpelRefine > 2 ? 3 : 1; /* is chroma satd possible?
*/
+
+ if (numSliceWeightedRows)
+ {
+ // Unnecessary, but avoid risk on parameters dynamic modify in future.
+ X265_FREE(numSliceWeightedRows);
+ numSliceWeightedRows = NULL;
+ }
numSliceWeightedRows = X265_MALLOC(uint32_t, p.maxSlices);
memset(numSliceWeightedRows, 0, p.maxSlices * sizeof(uint32_t));
--
1.7.9.msysgit.0
_______________________________________________
x265-devel mailing list
[email protected]
https://mailman.videolan.org/listinfo/x265-devel