Mercurial > hg > th-libs
diff th_ioctx_mem.c @ 694:0fc5ddaccc57
Implement fclose() in mem ioctx, with an context flag for freeing the memory
on fclose().
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Mon, 09 Mar 2020 18:55:54 +0200 |
parents | a622d21833e1 |
children | e73200c4584a |
line wrap: on
line diff
--- a/th_ioctx_mem.c Mon Mar 09 18:54:37 2020 +0200 +++ b/th_ioctx_mem.c Mon Mar 09 18:55:54 2020 +0200 @@ -43,6 +43,13 @@ } +static void th_mem_fclose(th_ioctx *ctx) +{ + if (ctx->memFree) + th_free_r(&ctx->memData); +} + + static BOOL th_mem_realloc(th_ioctx *ctx, const size_t newSize) { size_t grow; @@ -222,7 +229,7 @@ "MemIO", th_mem_fopen, - NULL, + th_mem_fclose, th_mem_freset, th_mem_ferror,