Skip to content

Commit

Permalink
Fix GLib-WARNING about GError.
Browse files Browse the repository at this point in the history
The warning:
GLib-WARNING **: GError set over the top of a previous GError or uninitialized memory.
This indicates a bug in someone's code. You must ensure an error is NULL before it's set.
  • Loading branch information
nikola-benes committed Oct 23, 2014
1 parent 42da2fb commit 5d05935
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/commands.c
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ do_connect (void)
if (!lm_connection_open (state.conn, ft_connection_open_cb,
(gpointer)&state, NULL, &state.error)) {
PRINTF (state.error->message);
g_clear_error(&state.error); // free error and set it to NULL
return -4;
}

Expand Down Expand Up @@ -172,6 +173,7 @@ do_connect_blocking (void)

if (!lm_connection_open_and_block (state.conn, &state.error)) {
PRINTF (_("Could not connect."));
g_clear_error(&state.error); // free error and set it to NULL
return -4;
}

Expand Down

0 comments on commit 5d05935

Please sign in to comment.