From a15d5a88e0a5e17fb03dcc7f2dbebe867945637b Mon Sep 17 00:00:00 2001 From: Lev Brouk Date: Tue, 5 Nov 2024 09:37:42 -0800 Subject: [PATCH] PR feedback --- src/micro.c | 15 ++++++++------- src/micro_endpoint.c | 3 +-- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/micro.c b/src/micro.c index 94625b60..ba4090a3 100644 --- a/src/micro.c +++ b/src/micro.c @@ -276,15 +276,16 @@ _attach_service_to_connection(natsConnection *nc, microService *service) else nc->services = tmp; } - } - if (s == NATS_OK) - { - service->refs++; // no lock needed, called from the constructor - nc->services[nc->numServices] = service; - nc->numServices++; + if (s == NATS_OK) + { + service->refs++; // no lock needed, called from the constructor + nc->services[nc->numServices] = service; + nc->numServices++; + } + natsMutex_Unlock(nc->servicesMu); } - natsMutex_Unlock(nc->servicesMu); + natsConn_Unlock(nc); return micro_ErrorFromStatus(s); diff --git a/src/micro_endpoint.c b/src/micro_endpoint.c index a1a6d3b5..4249d4a5 100644 --- a/src/micro_endpoint.c +++ b/src/micro_endpoint.c @@ -279,7 +279,7 @@ micro_clone_endpoint_config(microEndpointConfig **out, microEndpointConfig *cfg) microEndpointConfig *new_cfg = NULL; if (out == NULL) - return microError_Wrapf(err, "failed to clone endpoint config: '%s'", cfg->Name); + return microError_Wrapf(micro_ErrorInvalidArg, "failed to clone endpoint config: '%s'", cfg->Name); if (cfg == NULL) { @@ -303,7 +303,6 @@ micro_clone_endpoint_config(microEndpointConfig **out, microEndpointConfig *cfg) { micro_free_cloned_endpoint_config(new_cfg); return microError_Wrapf(err, "failed to clone endpoint config: '%s'", cfg->Name); - return err; } *out = new_cfg;