This is an automated email from the ASF dual-hosted git repository.

pengzheng pushed a commit to branch hotfix/dm_use_after_free
in repository https://gitbox.apache.org/repos/asf/celix.git

commit 670423e1ebba16a9024965389ebdd1f03e494fd2
Author: PengZheng <[email protected]>
AuthorDate: Mon Dec 12 18:06:55 2022 +0800

    Fixed use-after-free reported by CI.
---
 libs/framework/src/dm_component_impl.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/libs/framework/src/dm_component_impl.c 
b/libs/framework/src/dm_component_impl.c
index 58f73815..73ae3783 100644
--- a/libs/framework/src/dm_component_impl.c
+++ b/libs/framework/src/dm_component_impl.c
@@ -173,8 +173,9 @@ void celix_dmComponent_destroy(celix_dm_component_t 
*component) {
             celix_bundleContext_log(component->context, CELIX_LOG_LEVEL_ERROR,
                    "Cannot synchronized destroy dm component on Celix event 
thread. Use celix_dmComponent_destroyAsync instead!");
         } else {
+            celix_bundle_context_t* context = component->context;
             celix_dmComponent_destroyAsync(component, NULL, NULL);
-            celix_bundleContext_waitForEvents(component->context);
+            celix_bundleContext_waitForEvents(context);
         }
     }
 }

Reply via email to