[telepathy-account-widgets] account-widget: Fix 'login_id' leak in _get_default_display_name()
- From: Christophe Fergeau <teuf src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [telepathy-account-widgets] account-widget: Fix 'login_id' leak in _get_default_display_name()
- Date: Fri, 31 Jul 2015 19:01:11 +0000 (UTC)
commit a72609e2d2f2afeacaadff304688d63bed164270
Author: Christophe Fergeau <cfergeau redhat com>
Date: Thu Jul 30 09:51:00 2015 +0200
account-widget: Fix 'login_id' leak in _get_default_display_name()
tpaw_account_get_default_display_name() returns early when login_id is non-NULL, and
only tries to g_free() it in the codepath after this early return, which causes a leak.
This commit moves the call to g_free (login_id) before the early return in the
(login_id != NULL) case. This fixes:
==26855== 8 bytes in 1 blocks are definitely lost in loss record 13,180 of 34,041
==26855== at 0x4A06C50: malloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==26855== by 0x8A120AC: g_malloc (gmem.c:97)
==26855== by 0x8A123C5: g_malloc_n (gmem.c:336)
==26855== by 0x8A2DB9A: g_strdup (gstrfuncs.c:356)
==26855== by 0x8A4C05B: g_variant_dup_string (gvariant.c:1500)
==26855== by 0x4CB9B41: tpaw_account_settings_dup_string (tpaw-account-settings.c:843)
==26855== by 0x4CC0F8B: tpaw_account_widget_get_default_display_name (tpaw-account-widget.c:2155)
==26855== by 0x4CBDFE2: tpaw_account_widget_apply_and_log_in (tpaw-account-widget.c:999)
==26855== by 0x4CBE05C: account_widget_apply_clicked_cb (tpaw-account-widget.c:1017)
==26855== by 0x87741EA: g_cclosure_marshal_VOID__VOID (gmarshal.c:875)
==26855== by 0x8771238: g_closure_invoke (gclosure.c:801)
==26855== by 0x878E070: signal_emit_unlocked_R (gsignal.c:3581)
==26855== by 0x878D3A7: g_signal_emit_valist (gsignal.c:3337)
==26855== by 0x878D8E9: g_signal_emit (gsignal.c:3393)
==26855== by 0x7326A22: gtk_button_clicked (gtkbutton.c:1488)
==26855== by 0x7327943: gtk_button_do_release (gtkbutton.c:1899)
==26855== by 0x7327D22: gtk_real_button_released (gtkbutton.c:2017)
==26855== by 0x877427D: g_cclosure_marshal_VOID__VOIDv (gmarshal.c:905)
==26855== by 0x877190F: g_type_class_meta_marshalv (gclosure.c:1021)
==26855== by 0x87714D1: _g_closure_invoke_va (gclosure.c:864)
==26855== by 0x878C771: g_signal_emit_valist (gsignal.c:3246)
==26855== by 0x878D8E9: g_signal_emit (gsignal.c:3393)
==26855== by 0x73244D2: multipress_released_cb (gtkbutton.c:613)
==26855== by 0x36E5A05DAF: ffi_call_unix64 (unix64.S:76)
==26855== by 0x36E5A05817: ffi_call (ffi64.c:525)
==26855== by 0x8772F7C: g_cclosure_marshal_generic_va (gclosure.c:1594)
==26855== by 0x87714D1: _g_closure_invoke_va (gclosure.c:864)
==26855== by 0x878C771: g_signal_emit_valist (gsignal.c:3246)
==26855== by 0x878D8E9: g_signal_emit (gsignal.c:3393)
==26855== by 0x7421792: gtk_gesture_multi_press_end (gtkgesturemultipress.c:273)
==26855== by 0x8775B90: g_cclosure_marshal_VOID__BOXEDv (gmarshal.c:1950)
==26855== by 0x877190F: g_type_class_meta_marshalv (gclosure.c:1021)
==26855== by 0x87714D1: _g_closure_invoke_va (gclosure.c:864)
==26855== by 0x878C771: g_signal_emit_valist (gsignal.c:3246)
https://bugzilla.gnome.org/show_bug.cgi?id=752938
tp-account-widgets/tpaw-account-widget.c | 3 +--
1 files changed, 1 insertions(+), 2 deletions(-)
---
diff --git a/tp-account-widgets/tpaw-account-widget.c b/tp-account-widgets/tpaw-account-widget.c
index 64a97d1..9ba43af 100644
--- a/tp-account-widgets/tpaw-account-widget.c
+++ b/tp-account-widgets/tpaw-account-widget.c
@@ -2180,6 +2180,7 @@ tpaw_account_widget_get_default_display_name (TpawAccountWidget *self)
{
default_display_name = g_strdup (login_id);
}
+ g_free (login_id);
return default_display_name;
}
@@ -2198,8 +2199,6 @@ tpaw_account_widget_get_default_display_name (TpawAccountWidget *self)
default_display_name = g_strdup (_("New account"));
}
- g_free (login_id);
-
return default_display_name;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]