summaryrefslogtreecommitdiff
path: root/src/modules/swab
diff options
context:
space:
mode:
authorVito Caputo <vcaputo@pengaru.com>2023-08-30 17:26:56 -0700
committerVito Caputo <vcaputo@pengaru.com>2023-08-30 17:26:56 -0700
commitc91c9e5eeae06a7cbed94354d62c1281dc356407 (patch)
treea589ab8716cba804ec7c60e5882a2eec7f0033b7 /src/modules/swab
parent20d097ab1fe8ef5b62f4169f4353cc0074c27e4b (diff)
modules/*: til_module_context_free() error paths
Several modules still had vestigial ad-hoc free() cleanups on error paths in their create_context(). Largely mechanical change of replacing those with til_module_context_free() which is more appropriate, since the til_module_context_t holds a reference on the setup. A plain free() will leak that reference. But it's only on create_context() failures which are uncommon, so this was in practice mostly harmless...
Diffstat (limited to 'src/modules/swab')
-rw-r--r--src/modules/swab/swab.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/src/modules/swab/swab.c b/src/modules/swab/swab.c
index 9b7043c..343eb04 100644
--- a/src/modules/swab/swab.c
+++ b/src/modules/swab/swab.c
@@ -75,10 +75,8 @@ static til_module_context_t * swab_create_context(const til_module_t *module, ti
return NULL;
ctxt->din = din_new(12, 12, 100, seed);
- if (!ctxt->din) {
- free(ctxt);
- return NULL;
- }
+ if (!ctxt->din)
+ return til_module_context_free(&ctxt->til_module_context);
return &ctxt->til_module_context;
}
© All Rights Reserved