ANNOUNCEMENT: Live Wireshark University & Allegro Packets online APAC Wireshark Training Session
July 17th, 2024 | 10:00am-11:55am SGT (UTC+8) | Online

Wireshark-dev: [Wireshark-dev] Is this a bug?

From: Peter Fuller <randomcodemonky@xxxxxxxxxxxxxx>
Date: Sun, 16 Mar 2008 13:09:24 +0000

Dear developers,

   From rawshark.c: set_link_type(const char *lt_arg):

    if (dhandle) {
      encap = WTAP_ENCAP_USER0;
      pref_str = g_string_new("uat:user_dlts:");
      /* This must match the format used in the user_dlts file */
      g_string_sprintfa(pref_str,
        "\"User 0 (DLT=147)\",\"%s\",\"0\",\"\",\"0\",\"\"", spec_ptr);
      if (prefs_set_pref(pref_str->str) != PREFS_SET_OK) {
return FALSE; // <<<<<<<----- What about pref_str? No g_string_free(pref_str, TRUE)?
      }
      g_string_free(pref_str, TRUE);
      return TRUE;
    }

See above. If prefs not set, isn't this a memory leak? (sorry, I'd fix this myself if it were, but I'm still
a newbie and a bit tentative about changing other's code....)

rkm