# HG changeset patch # User Matti Hamalainen # Date 1583851677 -7200 # Node ID 29d9083dff1c8158664e9ec3ed96bd579aa412d8 # Parent 87e97ea5afd1049fa9b203909bbe54142cc8a5c5 Do not reallocate th_ioctx::mode string if it has not been allocated in the first place. diff -r 87e97ea5afd1 -r 29d9083dff1c th_ioctx.c --- a/th_ioctx.c Mon Mar 09 22:26:19 2020 +0200 +++ b/th_ioctx.c Tue Mar 10 16:47:57 2020 +0200 @@ -99,8 +99,15 @@ thfclose(ctx); - if ((ctx->status = th_pstr_cpy(&ctx->mode, mode)) != THERR_OK) - return ctx->status; + if (ctx->mallocated) + { + if ((ctx->status = th_pstr_cpy(&ctx->mode, mode)) != THERR_OK) + return ctx->status; + } + else + { + ctx->mode = mode; + } return (ctx->status = thfopen(ctx)); }