Skip to content

Commit

Permalink
kazoo: fix compiler warnings
Browse files Browse the repository at this point in the history
> 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)
  • Loading branch information
linuxmaniac committed Jan 5, 2017
1 parent b9c09b8 commit 40cc4fb
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/modules/kazoo/kz_amqp.c
Expand Up @@ -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;

Expand Down Expand Up @@ -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) {
Expand All @@ -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;
Expand Down

0 comments on commit 40cc4fb

Please sign in to comment.