Hi Peter,
W dniu 2018-03-15 13:24, Peter Wu napisał(a):
I was looking at memleaks as reported by LSAN while running the
decryption test suite, there are quite a number of occurrences.
One of them is tap (return value of register_tap_listener) which is a
GString which seems unnecessary since it is an error message which the
caller should not have to modify. Dario tried to convert that to a
gchar
before in https://code.wireshark.org/review/15270 but that particular
patch was reverted in v2.1.1rc0-197-ga383e692c8.
Pascal tried again in https://code.wireshark.org/review/16053, but
somehow it also got stuck. Before trying to touch this again, is there
something to be aware of? I just want to modify register_tap_listener:
- Change GString to char *
- Either use NULL wmem scope or use g_strdup_printf.
- Add G_GNUC_WARN_UNUSED_RESULT such that callers will not accidentally
leak any error messages.
- Modify callers such that they do check the error. (g_warning?)
Can register_tap_listener() return enum code (one of: success, not
found, wrong filter)?
You will get rid of memleak, and users will get nicely translated
message error.