From bc23f797296582d5aca5029dd34244de41ff8605 Mon Sep 17 00:00:00 2001 From: Guy Harris Date: Tue, 13 Jan 2015 12:13:45 -0800 Subject: UAT error string pointers should not be const pointers. UAT error strings are usually allocated by g_strdup() or g_strdup_printf(), and must ultimately be freed by the caller. Make the pointer-to-error-string-pointer arguments to various functions be "char **", not "const char **". Fix cases that finds where a raw string was being used, as that won't work if you try to free it; g_strdup() it instead. Add a missing free of an error string. Remove some no-longer-necessary casts. Remove some unnecessary g_strdup()s (the string being handed to it was already g_malloc()ated). Change some variable declarations to match. Put in XXX comments for some cases where the error string is just freed, without being shown to the user. Change-Id: I40297746a2ef729c56763baeddbb0842386fa0d0 Reviewed-on: https://code.wireshark.org/review/6525 Reviewed-by: Guy Harris --- ui/gtk/uat_gui.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'ui/gtk/uat_gui.c') diff --git a/ui/gtk/uat_gui.c b/ui/gtk/uat_gui.c index 3321420bf1..2783dc5fcf 100644 --- a/ui/gtk/uat_gui.c +++ b/ui/gtk/uat_gui.c @@ -362,7 +362,7 @@ static gboolean uat_dlg_cb(GtkWidget *win _U_, gpointer user_data) { } if (f[colnum].cb.chk) { - if (! f[colnum].cb.chk(dd->rec, text, len, f[colnum].cbdata.chk, f[colnum].fld_data, (const char**)&err)) { + if (! f[colnum].cb.chk(dd->rec, text, len, f[colnum].cbdata.chk, f[colnum].fld_data, &err)) { tmp_err = err; err = g_strdup_printf("error in column '%s': %s", f[colnum].title, tmp_err); g_free(tmp_err); @@ -376,7 +376,7 @@ static gboolean uat_dlg_cb(GtkWidget *win _U_, gpointer user_data) { } if (dd->uat->update_cb) { - dd->uat->update_cb(dd->rec, (const char**)&err); + dd->uat->update_cb(dd->rec, &err); if (err) { tmp_err = err; -- cgit v1.2.1