Browse Source

Free smsg in constant place in srecv_process

master
Con Kolivas 9 years ago
parent
commit
bd70c7b276
  1. 18
      src/stratifier.c

18
src/stratifier.c

@ -6040,9 +6040,7 @@ static void srecv_process(ckpool_t *ckp, char *buf)
parse_node_msg(ckp, sdata, msg->json_msg, buf);
else
LOGWARNING("Failed to extract client_id from connector json smsg %s", buf);
json_decref(msg->json_msg);
free(msg);
goto out;
goto out_freemsg;
}
msg->client_id = json_integer_value(val);
@ -6051,9 +6049,7 @@ static void srecv_process(ckpool_t *ckp, char *buf)
val = json_object_get(msg->json_msg, "address");
if (unlikely(!val)) {
LOGWARNING("Failed to extract address from connector json smsg %s", buf);
json_decref(msg->json_msg);
free(msg);
goto out;
goto out_freemsg;
}
strcpy(address, json_string_value(val));
json_object_clear(val);
@ -6061,9 +6057,7 @@ static void srecv_process(ckpool_t *ckp, char *buf)
val = json_object_get(msg->json_msg, "server");
if (unlikely(!val)) {
LOGWARNING("Failed to extract server from connector json smsg %s", buf);
json_decref(msg->json_msg);
free(msg);
goto out;
goto out_freemsg;
}
server = json_integer_value(val);
json_object_clear(val);
@ -6086,8 +6080,7 @@ static void srecv_process(ckpool_t *ckp, char *buf)
LOGNOTICE("Stratifier skipped dropped instance %"PRId64" message from server %d",
msg->client_id, server);
connector_drop_client(ckp, msg->client_id);
free_smsg(msg);
goto out;
goto out_freemsg;
}
if (unlikely(noid))
LOGINFO("Stratifier added instance %"PRId64" server %d", client->id, server);
@ -6098,8 +6091,9 @@ static void srecv_process(ckpool_t *ckp, char *buf)
node_client_msg(ckp, msg->json_msg, buf, client);
else
parse_instance_msg(ckp, sdata, msg, client);
free_smsg(msg);
dec_instance_ref(sdata, client);
out_freemsg:
free_smsg(msg);
out:
free(buf);
}

Loading…
Cancel
Save