Text   |  XML   |  ReML   |   Visible Warnings:

Useless Assignment  at tap-wspstat.c:228

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

wspstat_init

(/home/sate/Testcases/c/cve/wireshark-1.2.0/tap-wspstat.c)expand/collapse
Show more  
 217  wspstat_init(const char *optarg, void* userdata _U_)
 218  {
 219          wspstat_t *sp;
 220          const char *filter=NULL;
 221          guint32 i;
 222          GString *error_string;
 223          wsp_status_code_t *sc;
 224           
 225          if (!strncmp (optarg, "wsp,stat," , 9)){
 226                  filter=optarg+9;
 227          } else {
 228                  filter=NULL;
 229          }
 230           
 231                   
 232          sp = g_malloc( sizeof(wspstat_t) );
 233          sp->hash = g_hash_table_new( g_int_hash, g_int_equal);
 234          for (i=0 ; vals_status[i].strptr ; i++ )
 235          {
 236                  gint *key;
 237                  sc=g_malloc( sizeof(wsp_status_code_t) );
 238                  key=g_malloc( sizeof(gint) );
 239                  sc->packets=0;
 240                  sc->name=vals_status[i].strptr;
 241                  *key=vals_status[i].value;
 242                  g_hash_table_insert(
 243                                  sp->hash,
 244                                  key,
 245                                  sc);
 246          }
 247          sp->num_pdus = 16;
 248          sp->pdu_stats=g_malloc( (sp->num_pdus+1) * sizeof( wsp_pdu_t) );
 249          if(filter){
 250                  sp->filter=g_strdup(filter);
 251          } else {
 252                  sp->filter=NULL;
 253          }
 254          for (i=0;i<sp->num_pdus; i++)
 255          {
 256                  sp->pdu_stats[i].packets=0;
 257                  sp->pdu_stats[i].type = match_strval( index2pdut( i ), vals_pdu_type) ;
 258          }
 259   
 260          error_string = register_tap_listener(  
 261                          "wsp",
 262                          sp,
 263                          filter,
 264                          wspstat_reset,
 265                          wspstat_packet,
 266                          wspstat_draw);
 267          if (error_string){
 268                  /* error, we failed to attach to the tap. clean up */
 269                  g_free(sp->pdu_stats);
 270                  g_free(sp->filter);
 271                  g_free(sp);
 272                  g_hash_table_foreach( sp->hash, (GHFunc) wsp_free_hash_table, NULL ) ;
 273                  g_hash_table_destroy( sp->hash );
 274                  fprintf(stderr, "tshark: Couldn't register wsp,stat tap: %s\n",
 275                                  error_string->str);
 276                  g_string_free(error_string, TRUE);
 277                  exit(1);
 278          }
 279  }
Show more  




Change Warning 4881.30918 : Useless Assignment

Priority:
State:
Finding:
Owner:
Note: