Module: kamailio Branch: master Commit: 5c3a00871a73f73843fe83b5c16dd9eecb1207e0 URL: https://github.com/kamailio/kamailio/commit/5c3a00871a73f73843fe83b5c16dd9ee...
Author: Victor Seva linuxmaniac@torreviejawireless.org Committer: Victor Seva linuxmaniac@torreviejawireless.org Date: 2022-07-01T15:10:55+02:00
kazoo: fix build warning
Warning: kz_amqp.c:2271:6: warning: variable 'num_headers' is used uninitialized whenever 'if' condition is true [-Wsometimes-uninitialized] if(idx == -1) { ^~~~~~~~~ kz_amqp.c:2327:6: note: uninitialized use occurs here if (num_headers > 0) { ^~~~~~~~~~~ kz_amqp.c:2271:3: note: remove the 'if' if its condition is always false if(idx == -1) { ^~~~~~~~~~~~~~~ kz_amqp.c:2281:5: note: variable 'num_headers' is declared here int num_headers = 0; ^ 1 warning generated.
---
Modified: src/modules/kazoo/kz_amqp.c
---
Diff: https://github.com/kamailio/kamailio/commit/5c3a00871a73f73843fe83b5c16dd9ee... Patch: https://github.com/kamailio/kamailio/commit/5c3a00871a73f73843fe83b5c16dd9ee...
---
diff --git a/src/modules/kazoo/kz_amqp.c b/src/modules/kazoo/kz_amqp.c index c7088a3c712..873d6fe421c 100644 --- a/src/modules/kazoo/kz_amqp.c +++ b/src/modules/kazoo/kz_amqp.c @@ -2259,7 +2259,8 @@ int kz_amqp_send_ex(kz_amqp_server_ptr srv, kz_amqp_cmd_ptr cmd, kz_amqp_channel amqp_bytes_t routing_key = {0,0}; amqp_bytes_t payload = {0,0}; int ret = -1; - json_obj_ptr json_obj = NULL; + json_obj_ptr json_obj = NULL; + int num_headers = 0;
amqp_basic_properties_t props; memset(&props, 0, sizeof(amqp_basic_properties_t)); @@ -2278,7 +2279,6 @@ int kz_amqp_send_ex(kz_amqp_server_ptr srv, kz_amqp_cmd_ptr cmd, kz_amqp_channel routing_key = amqp_bytes_malloc_dup(amqp_cstring_bytes(cmd->routing_key)); payload = amqp_bytes_malloc_dup(amqp_cstring_bytes(cmd->payload));
- int num_headers = 0; if ( (cmd->headers != NULL) && (strlen (cmd->headers) > 0 ) ) { num_headers = add_amqp_headers(cmd->headers, &props); }