Module: kamailio
Branch: master
Commit: 40cc4fb4c7c36039f1e6c2dc9ee940fb66f3a7bc
URL:
https://github.com/kamailio/kamailio/commit/40cc4fb4c7c36039f1e6c2dc9ee940f…
Author: Victor Seva <linuxmaniac(a)torreviejawireless.org>
Committer: Victor Seva <linuxmaniac(a)torreviejawireless.org>
Date: 2017-01-05T15:12:02+01:00
kazoo: fix compiler warnings
kz_amqp.c:1646:5: warning: this 'if' clause
does not guard... [-Wmisleading-indentation]
if(json_obj != NULL)
^~
kz_amqp.c:1649:2: note: ...this statement, but the latter is misleadingly indented as if
it is guarded by the 'if'
return -1;
^~~~~~
kz_amqp.c: In function 'maybe_add_consumer_key':
kz_amqp.c:2500:5: warning: this 'if' clause does not guard...
[-Wmisleading-indentation]
if (json_obj == NULL)
^~
kz_amqp.c:2503:2: note: ...this statement, but the latter is misleadingly indented as if
it is guarded by the 'if'
json_object* server_id_obj = kz_json_get_object(json_obj, BLF_JSON_SERVERID);
^~~~~~~~~~~
kz_amqp.c: In function 'kz_send_targeted_cmd':
kz_amqp.c:2574:4: warning: 'json_obj' may be used uninitialized in this function
[-Wmaybe-uninitialized]
if(json_obj)
---
Modified: src/modules/kazoo/kz_amqp.c
---
Diff:
https://github.com/kamailio/kamailio/commit/40cc4fb4c7c36039f1e6c2dc9ee940f…
Patch:
https://github.com/kamailio/kamailio/commit/40cc4fb4c7c36039f1e6c2dc9ee940f…
---
diff --git a/src/modules/kazoo/kz_amqp.c b/src/modules/kazoo/kz_amqp.c
index 020b98e..61e3e3e 100644
--- a/src/modules/kazoo/kz_amqp.c
+++ b/src/modules/kazoo/kz_amqp.c
@@ -1643,8 +1643,9 @@ int kz_amqp_subscribe(struct sip_msg* msg, char* payload)
if(binding != NULL)
shm_free(binding);
- if(json_obj != NULL)
+ if(json_obj != NULL){
json_object_put(json_obj);
+ }
return -1;
@@ -2497,8 +2498,9 @@ char* maybe_add_consumer_key(int server_id, amqp_bytes_t body)
{
char* payload = kz_amqp_bytes_dup(body);
json_obj_ptr json_obj = kz_json_parse(payload );
- if (json_obj == NULL)
- return payload ;
+ if (json_obj == NULL) {
+ return payload ;
+ }
json_object* server_id_obj = kz_json_get_object(json_obj, BLF_JSON_SERVERID);
if(server_id_obj == NULL) {
@@ -2522,13 +2524,14 @@ void kz_send_targeted_cmd(int server_id, amqp_bytes_t body)
kz_amqp_cmd_ptr cmd = NULL;
json_object* JObj = NULL;
char* payload = kz_local_amqp_bytes_dup(body);
+ json_obj_ptr json_obj = NULL;
if(payload == NULL) {
LM_ERR("error allocating message payload\n");
goto error;
}
- json_obj_ptr json_obj = kz_json_parse(payload );
+ json_obj = kz_json_parse(payload );
if (json_obj == NULL) {
LM_ERR("error parsing json payload\n");
goto error;