changeset 719:d51c277bea6b

Set th_ioctx::memAlloc to zero in th_mem_fclose() if memory is freed. This fixes the issue if file is reopened and th_mem_realloc() fails to notice that we have no allocated memory.
author Matti Hamalainen <ccr@tnsp.org>
date Wed, 11 Nov 2020 13:35:03 +0200
parents ffd97ca9dfce
children ff724f45162a
files th_ioctx_mem.c
diffstat 1 files changed, 4 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/th_ioctx_mem.c	Wed Nov 11 13:23:24 2020 +0200
+++ b/th_ioctx_mem.c	Wed Nov 11 13:35:03 2020 +0200
@@ -46,7 +46,11 @@
 static void th_mem_fclose(th_ioctx *ctx)
 {
     if (ctx->memFree)
+    {
         th_free_r(&ctx->memData);
+        ctx->memAlloc = 0;
+        ctx->memSize = 0;
+    }
 }