diff options
| author | Frédéric Desbiens <[email protected]> | 2026-07-27 10:30:29 -0400 |
|---|---|---|
| committer | GitHub <[email protected]> | 2026-07-27 10:30:29 -0400 |
| commit | 92ce0754ed42f9d9d1121805057db5cc9c171d66 (patch) | |
| tree | 36c16c1919c2fcf164f0774f25956f5875278db2 /common_modules/module_lib/src | |
| parent | d2de89df189f15de7539782b61e6e78f0bb03641 (diff) | |
Marked txm_module_object_deallocate as deprecated (#559)
Added a compile-time #pragma message warning to the module library
source so that any module that includes or compiles this file receives
an explicit deprecation notice at build time.
Updated the internal documentation block in the manager-side
implementation to explain that this function must not be called directly
and that calling it on a live object causes a use-after-free.
The Module Manager dispatch layer already releases pool memory
automatically after a successful tx_*_delete() call. Module authors
should remove any explicit call to txm_module_object_deallocate().
Co-authored-by: Copilot <[email protected]>
Diffstat (limited to 'common_modules/module_lib/src')
| -rw-r--r-- | common_modules/module_lib/src/txm_module_object_deallocate.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/common_modules/module_lib/src/txm_module_object_deallocate.c b/common_modules/module_lib/src/txm_module_object_deallocate.c index c0ffb097..480c6100 100644 --- a/common_modules/module_lib/src/txm_module_object_deallocate.c +++ b/common_modules/module_lib/src/txm_module_object_deallocate.c @@ -23,6 +23,27 @@ #define TXM_MODULE #include "txm_module.h" #ifndef TXM_MODULE_OBJECT_DEALLOCATE_CALL_NOT_USED + +/* DEPRECATION NOTICE + * txm_module_object_deallocate() is deprecated and must not be used in new + * code. It is retained only for backward-compatibility with existing modules. + * + * WHY: when a module calls tx_timer_delete(), tx_semaphore_delete(), or any + * other tx_*_delete() service, the Module Manager dispatch layer automatically + * releases the associated object pool memory after the kernel cleanup + * completes. No separate deallocation call is required or expected. + * + * WHAT TO DO: remove any call to txm_module_object_deallocate() from your + * module. The corresponding tx_*_delete() call already handles everything. + * + * RISK: calling txm_module_object_deallocate() on a live kernel object (one + * whose tx_*_delete() has not yet been called) frees the backing pool memory + * while the object is still referenced by the kernel, which is undefined + * behaviour (use-after-free). + */ +#pragma message("txm_module_object_deallocate() is deprecated and must not be used. " \ + "Call tx_*_delete() instead; the Module Manager dispatch layer " \ + "releases pool memory automatically on success.") /**************************************************************************/ /* */ /* FUNCTION RELEASE */ |
