Skip to content

Commit

Permalink
carrierroute: avoid comparing size_t types with negative values
Browse files Browse the repository at this point in the history
  • Loading branch information
Claudiu Boriga committed Aug 1, 2017
1 parent 2772f09 commit d8fdcb3
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/modules/carrierroute/cr_db.c
Original file line number Diff line number Diff line change
Expand Up @@ -280,15 +280,17 @@ int load_route_data_db(struct route_data_t * rd) {
return -1;
}

if((rd->carrier_num = load_carrier_map(rd)) <= 0){
if((ret = load_carrier_map(rd)) <= 0){
LM_ERR("error while retrieving carriers\n");
goto errout;
}
rd->carrier_num = (size_t)ret;

if((rd->domain_num = load_domain_map(rd)) <= 0){
if((ret = load_domain_map(rd)) <= 0){
LM_ERR("error while retrieving domains\n");
goto errout;
}
rd->domain_num = (size_t)ret;

if ((rd->carriers = shm_malloc(sizeof(struct carrier_data_t *) * rd->carrier_num)) == NULL) {
SHM_MEM_ERROR;
Expand Down

0 comments on commit d8fdcb3

Please sign in to comment.