ganeshmurthy commented on a change in pull request #817:
URL: https://github.com/apache/qpid-dispatch/pull/817#discussion_r467225755



##########
File path: src/router_core/modules/mobile_sync/mobile.c
##########
@@ -206,6 +206,15 @@ static void 
qcm_mobile_sync_compose_diff_hint_list(qdrm_mobile_sync_t *msync, qd
 
 static qd_message_t 
*qcm_mobile_sync_compose_differential_mau(qdrm_mobile_sync_t *msync, const char 
*address)
 {
+    //
+    // DISPATCH-1738: If the router is shutting down, the qd_dispatch_free() 
in dispatch.c frees the qd->router_id and
+    // sets the core->router_id to zero. When the core is shutting down, the 
core->router_id will be zero
+    // and we don't want to proceed with this function. We return here in 
order to prevent the use after free error on
+    // msync->core->router_id down below in the function.
+    //
+    if (! msync->core->router_id)
+        return 0;
+

Review comment:
       To future proof it if somebody tries to change the order of shutdown 
just like I did :)

##########
File path: src/dispatch.c
##########
@@ -358,14 +358,14 @@ static void qd_dispatch_set_router_area(qd_dispatch_t 
*qd, char *_area) {
 void qd_dispatch_free(qd_dispatch_t *qd)
 {
     if (!qd) return;
+    qd_router_free(qd->router);

Review comment:
       ok will do




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to