[FFmpeg-devel] [PATCH 2/2] lavc/mediacodec_wrapper: fix potential jni global reference leak

Matthieu Bouron matthieu.bouron at gmail.com
Sat Dec 16 02:09:43 EET 2017


On Thu, Dec 14, 2017 at 11:09:14AM +0100, Matthieu Bouron wrote:
> ---
>  libavcodec/mediacodec_wrapper.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/libavcodec/mediacodec_wrapper.c b/libavcodec/mediacodec_wrapper.c
> index 4660e895ca..f54e06b0ef 100644
> --- a/libavcodec/mediacodec_wrapper.c
> +++ b/libavcodec/mediacodec_wrapper.c
> @@ -1194,6 +1194,9 @@ fail:
>      }                                                                                       \
>                                                                                              \
>      if (ret < 0) {                                                                          \
> +        if (codec->object) {                                                                \
> +            (*env)->DeleteGlobalRef(env, codec->object);                                    \
> +        }                                                                                   \
>          ff_jni_reset_jfields(env, &codec->jfields, jni_amediacodec_mapping, 1, codec);      \
>          av_freep(&codec);                                                                   \
>      }                                                                                       \
> -- 
> 2.15.1
> 

Rebased patch applied.

-- 
Matthieu B.


More information about the ffmpeg-devel mailing list