yes but not in the same place :-)

what about with this?

diff --git a/src/modules/nats/nats_mod.c b/src/modules/nats/nats_mod.c
index 852d0fbbab..aff106c48f 100644
--- a/src/modules/nats/nats_mod.c
+++ b/src/modules/nats/nats_mod.c
@@ -226,12 +226,12 @@ int init_worker(
 
        nats_init_environment();
        nc = _init_nats_connection();
+       memset(worker, 0, sizeof(*worker));
        if(nats_init_connection(nc) < 0) {
                LM_ERR("failed to init nat connections\n");
                return -1;
        }
 
-       memset(worker, 0, sizeof(*worker));
        worker->subject = shm_malloc(strlen(subject) + 1);
        strcpy(worker->subject, subject);
        worker->subject[strlen(subject)] = '\0';
@@ -265,11 +265,11 @@ int init_pub_worker(
 {
        nats_connection_ptr nc = NULL;
        nc = _init_nats_connection();
+       memset(worker, 0, sizeof(*worker));
        if(nats_init_connection(nc) < 0) {
                LM_ERR("failed to init nat connections\n");
                return -1;
        }
-       memset(worker, 0, sizeof(*worker));
        worker->nc = nc;
        return 0;
 }
@@ -588,7 +588,8 @@ int nats_destroy_workers()
                                        LM_ERR("could not cleanup worker connection\n");
                                }
                        }
-                       uv_poll_stop(&pub_worker->poll);
+                       if(pub_worker->poll.type != UV_UNKNOWN_HANDLE)
+                               uv_poll_stop(&pub_worker->poll);
                        shm_free(pub_worker);
                }
        }


Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: <kamailio/kamailio/issues/3253/1262096114@github.com>