Skip to content

Commit

Permalink
clusterer: prevent NULL dereference
Browse files Browse the repository at this point in the history
Fixes Coverity CID #165038
  • Loading branch information
razvancrainea committed Mar 23, 2017
1 parent 0a0fb27 commit 2ac7887
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions modules/clusterer/node_info.c
Expand Up @@ -648,6 +648,10 @@ clusterer_node_t* get_clusterer_nodes(int cluster_id)
lock_start_read(cl_list_lock);

cl = get_cluster_by_id(cluster_id);
if (!cl) {
LM_DBG("cluster node id %d not found!\n", cluster_id);
goto end;
}
for (node = cl->node_list; node; node = node->next) {
if (get_next_hop(node) > 0)
if (add_clusterer_node(&ret_nodes, node) < 0) {
Expand All @@ -659,6 +663,7 @@ clusterer_node_t* get_clusterer_nodes(int cluster_id)
}
}

end:
lock_stop_read(cl_list_lock);

return ret_nodes;
Expand Down

0 comments on commit 2ac7887

Please sign in to comment.