<p></p>
<p dir="auto">yes but not in the same place :-)</p>
<p dir="auto">what about with this?</p>
<pre class="notranslate"><code class="notranslate">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);
                }
        }
</code></pre>

<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">—<br />Reply to this email directly, <a href="https://github.com/kamailio/kamailio/issues/3253#issuecomment-1262096114">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/ABO7UZIGADT63A5BMLU4OI3WAVWVRANCNFSM6AAAAAAQXGUX5E">unsubscribe</a>.<br />You are receiving this because you are subscribed to this thread.<img src="https://github.com/notifications/beacon/ABO7UZI37XWRO4OHEAP4N5LWAVWVRA5CNFSM6AAAAAAQXGUX5GWGG33NNVSW45C7OR4XAZNMJFZXG5LFINXW23LFNZ2KUY3PNVWWK3TUL5UWJTSLHIHPE.gif" height="1" width="1" alt="" /><span style="color: transparent; font-size: 0; display: none; visibility: hidden; overflow: hidden; opacity: 0; width: 0; height: 0; max-width: 0; max-height: 0; mso-hide: all">Message ID: <span><kamailio/kamailio/issues/3253/1262096114</span><span>@</span><span>github</span><span>.</span><span>com></span></span></p>
<script type="application/ld+json">[
{
"@context": "http://schema.org",
"@type": "EmailMessage",
"potentialAction": {
"@type": "ViewAction",
"target": "https://github.com/kamailio/kamailio/issues/3253#issuecomment-1262096114",
"url": "https://github.com/kamailio/kamailio/issues/3253#issuecomment-1262096114",
"name": "View Issue"
},
"description": "View this Issue on GitHub",
"publisher": {
"@type": "Organization",
"name": "GitHub",
"url": "https://github.com"
}
}
]</script>