[geany/geany-plugins] 697fc7: debugger: Fix a few GError leaks

Colomban Wendling git-noreply at xxxxx
Sun Nov 15 17:28:13 UTC 2015


Branch:      refs/heads/master
Author:      Colomban Wendling <ban at herbesfolles.org>
Committer:   Colomban Wendling <ban at herbesfolles.org>
Date:        Fri, 24 Oct 2014 14:25:21 UTC
Commit:      697fc79123395b1c97a24334d3ef32bbdaa44922
             https://github.com/geany/geany-plugins/commit/697fc79123395b1c97a24334d3ef32bbdaa44922

Log Message:
-----------
debugger: Fix a few GError leaks


Modified Paths:
--------------
    debugger/src/dbm_gdb.c

Modified: debugger/src/dbm_gdb.c
10 lines changed, 6 insertions(+), 4 deletions(-)
===================================================================
@@ -155,9 +155,8 @@ static void shutdown_channel(GIOChannel ** ch)
 {
 	if (*ch)
 	{
-		GError *err = NULL;
 		gint fd = g_io_channel_unix_get_fd(*ch);
-		g_io_channel_shutdown(*ch, TRUE, &err);
+		g_io_channel_shutdown(*ch, TRUE, NULL);
 		g_io_channel_unref(*ch);
 		*ch = NULL;
 		if (fd >= 0)
@@ -239,6 +238,8 @@ static void gdb_input_write_line(const gchar *line)
 #ifdef DEBUG_OUTPUT
 			dbg_cbs->send_message(err->message, "red");
 #endif
+			if (err)
+				g_clear_error(&err);
 			break;
 		}
 	}
@@ -249,6 +250,8 @@ static void gdb_input_write_line(const gchar *line)
 #ifdef DEBUG_OUTPUT
 		dbg_cbs->send_message(err->message, "red");
 #endif
+		if (err)
+			g_clear_error(&err);
 	}
 }
 
@@ -715,7 +718,6 @@ static result_class exec_sync_command(const gchar* command, gboolean wait4prompt
  */
 static gboolean run(const gchar* file, const gchar* commandline, GList* env, GList *witer, GList *biter, const gchar* terminal_device, dbg_callbacks* callbacks)
 {
-	GError *err = NULL;
 	const gchar *exclude[] = { "LANG", NULL };
 	gchar **gdb_env = utils_copy_environment(exclude, "LANG", "C", NULL);
 	gchar *working_directory = g_path_get_dirname(file);
@@ -730,7 +732,7 @@ static gboolean run(const gchar* file, const gchar* commandline, GList* env, GLi
 	/* spawn GDB */
 	if (!g_spawn_async_with_pipes(working_directory, (gchar**)gdb_args, gdb_env,
 				     GDB_SPAWN_FLAGS, NULL,
-				     NULL, &gdb_pid, &gdb_in, &gdb_out, NULL, &err))
+				     NULL, &gdb_pid, &gdb_in, &gdb_out, NULL, NULL))
 	{
 		dbg_cbs->report_error(_("Failed to spawn gdb process"));
 		g_free(working_directory);



--------------
This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).


More information about the Plugins-Commits mailing list