make sure files and connections are closed, fixes #33, fixes #35

This commit is contained in:
Taner Sener 2021-04-30 22:47:34 +01:00
parent 909307c8bc
commit 95dc029215

View File

@ -91,12 +91,12 @@ static AVIOContext *create_fd_avio_context(const char *filename, int flags) {
static void close_fd_avio_context(AVIOContext *ctx) { static void close_fd_avio_context(AVIOContext *ctx) {
if (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); closeParcelFileDescriptor(*fd);
av_freep(&fd); av_freep(&fd);
ctx->opaque = NULL;
} }
ctx->opaque = NULL;
} }
} }