Also, more on the point, we have our own memory management system called wmem in which you allocate stuff within a scope and Wireshark handles freeing up the memory.
Look for a README.wmem underneath /doc as well as the Wireshark developer guide for usage and the examples
Cheers
Roland
> Am 24.12.2022 um 07:40 schrieb Guy Harris <gharris@xxxxxxxxx>:
>
> On Dec 23, 2022, at 4:17 PM, <jayrturner99@xxxxxxxxx> <jayrturner99@xxxxxxxxx> wrote:
>
>> I run Wireshark 4.1.0 with my plugin dissector. It runs well, dissects packets, reports issues, and behaves as expected. I can load a capture file, that has packets of my protocol, exit Wireshark, and get no output to the command line. I can load another capture file, that has packets of my protocol, and get many many errors like:
>> ** (wireshark:nnnnn) hh:mm:ss.fffffff [GLib CRITICAL] -- g_string_free: assertion 'string != NULL' failed
>> where:
>> • nnnnn is always the same number within a single run of Wireshark, and changes from run to run.
>
> It's the process ID of the process running Wireshark.
>
>> • The timestamps can be 0.01 to 0.03 seconds apart and give me more than 60 in a second.
>
> The code that's trying to free something "pointed to" by a null pointer is being executed many times within a second.
>
>> • The list is output whenever I run a display filter or clear the display filter.
>
> The packets are redirected when that happens, so it's probably happening within a dissector.
>
>> • The list seems to be the same size whether the filter returns all packets, or some, or even two.
>
> When a display filter is applied, it's applied to *all* packets.
>
>> Maybe it is getting this error in my dissector or in another one.
>
> Almost certainly. My guess is that it's your dissector; what happens if you remove your dissector?
>
>> Is the error saying that it is trying to free a non-null string that has already been freed?
>
> The beginning of g_string_free() is
>
> gchar *
> g_string_free (GString *string,
> gboolean free_segment)
> {
> gchar *segment;
>
> g_return_val_if_fail (string != NULL, NULL);
>
> and the g_return_val_if_fail() call is what's failing.
>
>> In any event, are there any recommendations for trying to locate this error?
>
> Look for all places in your code where you're calling g_string_free() and make sure they can't be called with a null pointer.
> ___________________________________________________________________________
> Sent via: Wireshark-dev mailing list <wireshark-dev@xxxxxxxxxxxxx>
> Archives: https://www.wireshark.org/lists/wireshark-dev
> Unsubscribe: https://www.wireshark.org/mailman/options/wireshark-dev
> mailto:wireshark-dev-request@xxxxxxxxxxxxx?subject=unsubscribe