From 95dc029215ede763f465890600150e65d90e2561 Mon Sep 17 00:00:00 2001 From: Taner Sener Date: Fri, 30 Apr 2021 22:47:34 +0100 Subject: [PATCH] make sure files and connections are closed, fixes #33, fixes #35 --- android/ffmpeg-kit-android-lib/src/main/cpp/saf_wrapper.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/android/ffmpeg-kit-android-lib/src/main/cpp/saf_wrapper.c b/android/ffmpeg-kit-android-lib/src/main/cpp/saf_wrapper.c index 68b0c69..772cf08 100644 --- a/android/ffmpeg-kit-android-lib/src/main/cpp/saf_wrapper.c +++ b/android/ffmpeg-kit-android-lib/src/main/cpp/saf_wrapper.c @@ -91,12 +91,12 @@ static AVIOContext *create_fd_avio_context(const char *filename, int flags) { static void close_fd_avio_context(AVIOContext *ctx) { if (ctx) { - if (fd_seek(ctx->opaque, 0, AVSEEK_SIZE) >= 0) { - int *fd = ctx->opaque; + int *fd = ctx->opaque; + if (fd_seek((void*)fd, 0, AVSEEK_SIZE) >= 0) { closeParcelFileDescriptor(*fd); av_freep(&fd); + ctx->opaque = NULL; } - ctx->opaque = NULL; } }