Text   |  XML   |  ReML   |   Visible Warnings:

Null Test After Dereference  at packet-ros.c:409

No properties have been set. | edit properties
Jump to warning location ↓ warning details...
Show Events | Options

ros_match_call_response

(/home/sate/Testcases/c/cve/wireshark-1.2.0/epan/dissectors/packet-ros.c)expand/collapse
Show more  
 335  static ros_call_response_t *
 336  ros_match_call_response(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint invokeId, gboolean isInvoke)
 337  {
 338    ros_call_response_t rcr, *rcrp=NULL;
 339    ros_conv_info_t *ros_info = ros_info_items;
 340   
 341    /* first see if we have already matched this */
 342   
 343    rcr.invokeId=invokeId;
 344    rcr.is_request = isInvoke;
 345   
 346    if(isInvoke) {
 347      rcr.req_frame=pinfo->fd->num;
 348      rcr.rep_frame=0;
 349    } else {
 350      rcr.req_frame=0;
 351      rcr.rep_frame=pinfo->fd->num;
 352    }
 353     
 354    rcrp=g_hash_table_lookup(ros_info->matched, &rcr);
 355   
 356    if(rcrp) {
 357      /* we have found a match */
 358      rcrp->is_request=rcr.is_request;
 359   
 360    } else {
 361       
 362      /* we haven't found a match - try and match it up */
 363   
 364      if(isInvoke) {
 365        /* this a a request - add it to the unmatched list */
 366   
 367        /* check that we dont already have one of those in the 
 368           unmatched list and if so remove it */
 369   
 370        rcr.invokeId=invokeId;
 371   
 372        rcrp=g_hash_table_lookup(ros_info->unmatched, &rcr);
 373   
 374        if(rcrp){
 375          g_hash_table_remove(ros_info->unmatched, rcrp);
 376        }
 377         
 378        /* if we cant reuse the old one, grab a new chunk */
 379        if(!rcrp){
 380          rcrp=se_alloc(sizeof(ros_call_response_t));
 381        }
 382        rcrp->invokeId=invokeId;
 383        rcrp->req_frame=pinfo->fd->num;
 384        rcrp->req_time=pinfo->fd->abs_ts;
 385        rcrp->rep_frame=0;
 386        rcrp->is_request=TRUE;
 387        g_hash_table_insert(ros_info->unmatched, rcrp, rcrp);
 388        return NULL;
 389   
 390      } else {
 391   
 392        /* this is a result - it should be in our unmatched list */
 393   
 394        rcr.invokeId=invokeId;
 395        rcrp=g_hash_table_lookup(ros_info->unmatched, &rcr);
 396   
 397        if(rcrp){
 398   
 399          if(!rcrp->rep_frame){
 400            g_hash_table_remove(ros_info->unmatched, rcrp);
 401            rcrp->rep_frame=pinfo->fd->num;
 402            rcrp->is_request=FALSE;
 403            g_hash_table_insert(ros_info->matched, rcrp, rcrp);
 404          }
 405        }
 406      }
 407    }
 408   
 409    if(rcrp){ /* we have found a match */
 410      proto_item *item = NULL;
 411   
 412      if(rcrp->is_request){
 413        item=proto_tree_add_uint(tree, hf_ros_response_in, tvb, 0, 0, rcrp->rep_frame);
 414        PROTO_ITEM_SET_GENERATED (item);
 415      } else {
 416        nstime_t ns;
 417        item=proto_tree_add_uint(tree, hf_ros_response_to, tvb, 0, 0, rcrp->req_frame);
 418        PROTO_ITEM_SET_GENERATED (item);
 419        nstime_delta(&ns, &pinfo->fd->abs_ts, &rcrp->req_time);
 420        item=proto_tree_add_time(tree, hf_ros_time, tvb, 0, 0, &ns);
 421        PROTO_ITEM_SET_GENERATED (item);
 422      }
 423    }
 424     
 425    return rcrp;
 426  }
Show more  




Change Warning 12318.30985 : Null Test After Dereference

Priority:
State:
Finding:
Owner:
Note: