aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsahlberg <sahlberg@f5534014-38df-0310-8fa8-9805f1628bb7>2006-06-22 11:43:18 +0000
committersahlberg <sahlberg@f5534014-38df-0310-8fa8-9805f1628bb7>2006-06-22 11:43:18 +0000
commit575a97002433435f4a94b1dc1b15e6744c2564f0 (patch)
treef383313cd40ba60934b7b70df808cb612907849d
parenta568c9c5725529df0438a40b3ee483631bebfc2a (diff)
add check that string is non-null before we dereference and gfree it
git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@18544 f5534014-38df-0310-8fa8-9805f1628bb7
-rw-r--r--gtk/find_dlg.c20
1 files changed, 13 insertions, 7 deletions
diff --git a/gtk/find_dlg.c b/gtk/find_dlg.c
index 51ee5b7f2f..5b11f89ad5 100644
--- a/gtk/find_dlg.c
+++ b/gtk/find_dlg.c
@@ -543,7 +543,7 @@ find_frame_ok_cb(GtkWidget *ok_bt _U_, gpointer parent_w)
size_t nbytes = 0;
char *string = NULL;
dfilter_t *sfcode = NULL;
- gboolean found_packet;
+ gboolean found_packet=FALSE;
filter_te = (GtkWidget *)OBJECT_GET_DATA(parent_w, E_FIND_FILT_KEY);
up_rb = (GtkWidget *)OBJECT_GET_DATA(parent_w, E_FIND_BACKWARD_KEY);
@@ -648,8 +648,10 @@ find_frame_ok_cb(GtkWidget *ok_bt _U_, gpointer parent_w)
/* OK, what are we searching? */
if (cfile.decode_data) {
/* The text in the protocol tree */
- found_packet = cf_find_packet_protocol_tree(&cfile, string);
- g_free(string);
+ if(string){
+ found_packet = cf_find_packet_protocol_tree(&cfile, string);
+ g_free(string);
+ }
if (!found_packet) {
/* We didn't find the packet. */
simple_dialog(ESD_TYPE_INFO, ESD_BTN_OK,
@@ -660,8 +662,10 @@ find_frame_ok_cb(GtkWidget *ok_bt _U_, gpointer parent_w)
}
} else if (cfile.summary_data) {
/* The text in the summary line */
- found_packet = cf_find_packet_summary_line(&cfile, string);
- g_free(string);
+ if(string){
+ found_packet = cf_find_packet_summary_line(&cfile, string);
+ g_free(string);
+ }
if (!found_packet) {
/* We didn't find the packet. */
simple_dialog(ESD_TYPE_INFO, ESD_BTN_OK,
@@ -672,8 +676,10 @@ find_frame_ok_cb(GtkWidget *ok_bt _U_, gpointer parent_w)
}
} else {
/* The raw packet data */
- found_packet = cf_find_packet_data(&cfile, string, strlen(string));
- g_free(string);
+ if(string){
+ found_packet = cf_find_packet_data(&cfile, string, strlen(string));
+ g_free(string);
+ }
if (!found_packet) {
/* We didn't find the packet. */
simple_dialog(ESD_TYPE_INFO, ESD_BTN_OK,