From 8f247df3e36d8c34baa31f1448db67c9028b2d9d Mon Sep 17 00:00:00 2001 From: zhuyaliang <15132211195@163.com> Date: Mon, 10 Jun 2019 18:03:27 +0800 Subject: Memory leak: g_error_free(error); --- capplets/time-admin/src/main.c | 9 ++++++--- capplets/time-admin/src/time-share.h | 1 - capplets/time-admin/src/time-tool.c | 14 +++----------- 3 files changed, 9 insertions(+), 15 deletions(-) (limited to 'capplets') diff --git a/capplets/time-admin/src/main.c b/capplets/time-admin/src/main.c index 5952b71a..a29cb89e 100644 --- a/capplets/time-admin/src/main.c +++ b/capplets/time-admin/src/main.c @@ -381,7 +381,7 @@ static gboolean InitDbusProxy(TimeAdmin *ta) if(ta->Connection == NULL) { MessageReport(_("g_bus_get_sync"),error->message,ERROR); - return FALSE; + goto EXIT; } ta->proxy = g_dbus_proxy_new_sync (ta->Connection, G_DBUS_PROXY_FLAGS_NONE, @@ -394,16 +394,19 @@ static gboolean InitDbusProxy(TimeAdmin *ta) if(ta->proxy == NULL) { MessageReport(_("g_bus_proxy_new"),error->message,ERROR); - return FALSE; + goto EXIT; } return TRUE; +EXIT: + g_error_free(error); + return FALSE; } int main(int argc, char **argv) { TimeAdmin ta; - bindtextdomain (PACKAGE, LOCALEDIR); + bindtextdomain (PACKAGE,MATELOCALEDIR); textdomain (PACKAGE); bind_textdomain_codeset (GETTEXT_PACKAGE_TIMEZONES, "UTF-8"); diff --git a/capplets/time-admin/src/time-share.h b/capplets/time-admin/src/time-share.h index 9ecd6999..bc7f8acf 100644 --- a/capplets/time-admin/src/time-share.h +++ b/capplets/time-admin/src/time-share.h @@ -33,7 +33,6 @@ #include #include -#define LOCALEDIR "/usr/share/locale/" #define _(STRING) gettext(STRING) #define C_(a,b) gettext(b) #define TYPEMSG "%s " diff --git a/capplets/time-admin/src/time-tool.c b/capplets/time-admin/src/time-tool.c index e8b94af8..e48f9368 100644 --- a/capplets/time-admin/src/time-tool.c +++ b/capplets/time-admin/src/time-tool.c @@ -185,12 +185,6 @@ void SetTimeZone(GDBusProxy *proxy,const char *zone) { MessageReport(_("Set time zone"),error->message,ERROR); } - else - { - - } - - } static void ChangeSpinBttonState(TimeAdmin *ta,gboolean State) { @@ -230,6 +224,7 @@ void ReloadNtp(GDBusProxy *proxy,gboolean state) if(ret1 == NULL || ret2 == NULL) { MessageReport(_("Reload Ntp sync"),error->message,ERROR); + g_error_free(error); } } @@ -250,6 +245,7 @@ gboolean ChangeNtpSync(GtkSwitch *widget,gboolean state,gpointer data) if(ret == NULL) { MessageReport(_("Set Ntp sync"),error->message,ERROR); + g_error_free(error); return TRUE; } else @@ -293,12 +289,8 @@ static void SetTime(GDBusProxy *proxy,gint64 TimeSec) if(ret == NULL) { MessageReport(_("Set Ntp sync"),error->message,ERROR); + g_error_free(error); } - else - { - - } - } void SaveModifyTime (GtkButton *button,gpointer data) { -- cgit v1.2.1