Text   |  XML   |  ReML   |   Visible Warnings:

Useless Assignment  at tap-comparestat.c:522

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

comparestat_init

(/home/sate/Testcases/c/cve/wireshark-1.2.0/tap-comparestat.c)expand/collapse
Show more  
 510  comparestat_init(const char *optarg, void* userdata _U_)
 511  {
 512          comparestat_t *cs;
 513          const char *filter=NULL;
 514          GString *error_string;
 515          gint start, stop,ttl, order, pos=0;
 516          gdouble variance;
 517   
 518          if(sscanf(optarg,"compare,%d,%d,%d,%d,%lf,%n",&start, &stop, &ttl, &order, &variance, &pos)==5){
 519                  if(pos){
 520                          filter=optarg+pos;
 521                  } else {
 522                          filter=NULL;
 523                  }
 524          } else {
 525                  fprintf(stderr, "tshark: invalid \"-z compare,<start>,<stop>,<ttl[0|1]>,<order[0|1]>,<variance>[,<filter>]\" argument\n");
 526                  exit(1);
 527          }
 528   
 529          compare_variance=variance;
 530          compare_start=start;
 531          compare_stop=stop;
 532          TTL_method=ttl;
 533          ON_method=order;
 534   
 535          cs=g_malloc(sizeof(comparestat_t));
 536          nstime_set_unset(&cs->current_time);
 537          cs->ip_ttl_list=g_array_new(FALSE, FALSE, sizeof(guint8));
 538          cs->last_hit=FALSE;
 539          cs->start_ongoing_hits=0;
 540          cs->stop_ongoing_hits=0;
 541          cs->start_packet_nr_first=G_MAXINT32;
 542          cs->start_packet_nr_second=G_MAXINT32;
 543          cs->stop_packet_nr_first=G_MAXINT32;
 544          cs->stop_packet_nr_second=G_MAXINT32;
 545          cs->first_file_amount=0;
 546          cs->second_file_amount=0;
 547   
 548          cs->zebra_time.secs=0;
 549          cs->zebra_time.nsecs=1;
 550          cs->nr_tree=se_tree_create(EMEM_TREE_TYPE_RED_BLACK, "nr_tree");
 551          /* microsecond precision */
 552          timestamp_set_precision(TS_PREC_AUTO_NSEC);
 553   
 554          if(filter){
 555                  cs->filter=g_strdup(filter);
 556          } else {
 557                  cs->filter=NULL;
 558          }
 559           
 560          /* create a Hash to count the packets with the same ip.id */
 561          cs->packet_tree=se_tree_create(EMEM_TREE_TYPE_RED_BLACK, "Packet_info_tree");
 562   
 563          error_string=register_tap_listener("ip", cs, filter, comparestat_reset, comparestat_packet, comparestat_draw);
 564          if(error_string){
 565                  /* error, we failed to attach to the tap. clean up */
 566                  g_free(cs->filter);
 567                  g_free(cs);
 568   
 569                  fprintf(stderr, "tshark: Couldn't register compare tap: %s\n", error_string->str);
 570                  g_string_free(error_string, TRUE);
 571                  exit(1);
 572          }
 573  }
Show more  




Change Warning 4858.30894 : Useless Assignment

Priority:
State:
Finding:
Owner:
Note: