From 8c63fc997dbfa0e6268537482df97d0fa744010a Mon Sep 17 00:00:00 2001 From: root Date: Fri, 31 Dec 1999 20:03:23 -0500 Subject: set output string pointer to NULL after freeing it --- globals.c | 1 + gpib.c | 9 ++++++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/globals.c b/globals.c index 79b84d3..098b85c 100644 --- a/globals.c +++ b/globals.c @@ -14,6 +14,7 @@ GlobalStruct globals = { .Registers.last_relay_driver_settings[2] = -1, .Registers.gpib_input_buffer[0] = 0, + .Registers.pending_output_message = NULL, .VxiLocks.locked_network_server = NO_SERVER_LOCKED }; diff --git a/gpib.c b/gpib.c index 7711e25..6210b79 100644 --- a/gpib.c +++ b/gpib.c @@ -635,8 +635,9 @@ int GPIB_check_for_device_clear_signal(void) TNT_4882_Status(STB,0x10,CLEAR); // Clear MAV bit g_free (globals.Registers.pending_output_message); + globals.Registers.pending_output_message = NULL; - TNT_Holdoff_off(); + TNT_Holdoff_off(); TNT_INT_STATUS(); return TRUE; @@ -788,6 +789,7 @@ void GPIB_start_query_response(gpointer *ignore_this, char *in_string) if (globals.Registers.pending_output_message != NULL) { queue_error_for_gpib_only(query_error_interrupted); g_free (globals.Registers.pending_output_message); + globals.Registers.pending_output_message = NULL; } globals.Registers.pending_output_message = g_strdup_printf ("%s\n", in_string); @@ -798,8 +800,8 @@ void GPIB_start_query_response(gpointer *ignore_this, char *in_string) void GPIB_finish_query_response() { if (!globals.HWDetect.gpib) { - return; - } + return; + } if (globals.Registers.pending_output_message == NULL) { return; @@ -888,6 +890,7 @@ void GPIB_finish_query_response() INTERFACE_STATUS|=UCMPL; // Set the user complete bit g_free (globals.Registers.pending_output_message); + globals.Registers.pending_output_message = NULL; if (GPIB_check_for_device_clear_signal()) { return; -- cgit