Text   |  XML   |  ReML   |   Visible Warnings:

Useless Assignment  at packet-http.c:1864

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

add_hf_info_for_headers

(/home/sate/Testcases/c/cve/wireshark-1.2.0/epan/dissectors/packet-http.c)expand/collapse
Show more  
 1833  add_hf_info_for_headers()
 1834  {
 1835          hf_register_info* hf = NULL;
 1836          gint* hf_id = NULL;
 1837          guint i = 0;
 1838          gchar* header_name;
 1839          GPtrArray* array;
 1840          guint new_entries = 0;
 1841          header_field_t* tmp_hdr = NULL;
 1842   
 1843          if (!header_fields_hash) {
 1844                  header_fields_hash = g_hash_table_new(g_str_hash, g_str_equal);
 1845          }
 1846   
 1847          if (num_header_fields) {
 1848                  array = g_ptr_array_new();
 1849   
 1850                  /* Make a list of fields which are not already added. This is useful only if 
 1851                   * preferences are reloaded and a new header field has been added. Perhaps unlikely
 1852                   * to be used, but no harm in adding it...
 1853                   */
 1854   
 1855                  /* Not checking if the UAT has more or same number of entries as the hash table
 1856                   * because it is possible that some entries are removed and some more added.
 1857                   * WARNING: We will not de-register fields which have been removed from the UAT
 1858                   *
 1859                   * XXX: PS, it turns out that in case of change in UAT, the prefs apply callback is not
 1860                   * called... so, some of this code will not work at the moment. However, I leave it 
 1861                   * in here for now because if the callback is called in future, it will work (at least 
 1862                   * in theory ;-).
 1863                   */
 1864                  for (i = 0; i < num_header_fields; i++) {
 1865                          if ((g_hash_table_lookup(header_fields_hash, header_fields[i].header_name)) == NULL) {
 1866                                  new_entries++;
 1867                                  g_ptr_array_add(array, &header_fields[i]);
 1868                          }
 1869                  }
 1870   
 1871                  if (new_entries) {
 1872                          hf = g_malloc0(sizeof(hf_register_info) * new_entries);
 1873                          for (i = 0; i < new_entries; i++) {
 1874                                  tmp_hdr = (header_field_t*) g_ptr_array_index(array, i);
 1875                                  hf_id = g_malloc(sizeof(gint));
 1876                                  *hf_id = -1;
 1877                                  header_name = g_strdup(tmp_hdr->header_name);
 1878   
 1879                                  hf[i].p_id = hf_id;
 1880                                  hf[i].hfinfo.name = header_name;
 1881                                  hf[i].hfinfo.abbrev = g_strdup_printf("http.header.%s", header_name);
 1882                                  hf[i].hfinfo.type = FT_STRING;
 1883                                  hf[i].hfinfo.display = BASE_NONE;
 1884                                  hf[i].hfinfo.strings = NULL;
 1885                                  hf[i].hfinfo.blurb = g_strdup(tmp_hdr->header_desc);
 1886                                  hf[i].hfinfo.same_name_prev = NULL;
 1887                                  hf[i].hfinfo.same_name_next = NULL;
 1888   
 1889                                  g_hash_table_insert(header_fields_hash, header_name, hf_id);
 1890                          }
 1891   
 1892                          proto_register_field_array(proto_http, hf, num_header_fields);
 1893                  }
 1894          }
 1895  }
Show more  




Change Warning 2646.30760 : Useless Assignment

Priority:
State:
Finding:
Owner:
Note: