[network-manager-applet] applet: fix reading uninitialized memory on import
- From: Dan Williams <dcbw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [network-manager-applet] applet: fix reading uninitialized memory on import
- Date: Thu, 10 Mar 2011 07:38:01 +0000 (UTC)
commit eb13453f7dfb4bb65b5736adf2fa1eb642e10cc1
Author: Dan Williams <dcbw redhat com>
Date: Thu Mar 10 01:39:00 2011 -0600
applet: fix reading uninitialized memory on import
Can't use the NMRemoteConnection if there's been an error importing,
since it'll be NULL.
src/applet.c | 7 +++++--
1 files changed, 5 insertions(+), 2 deletions(-)
---
diff --git a/src/applet.c b/src/applet.c
index e0be9f9..728f579 100644
--- a/src/applet.c
+++ b/src/applet.c
@@ -3129,11 +3129,14 @@ add_cb (NMRemoteSettings *settings,
GError *error,
gpointer user_data)
{
+ NMConnection *c = user_data;
+
if (error) {
g_warning ("Failed to move connection '%s' to NetworkManager system settings: %s",
- nm_connection_get_id (NM_CONNECTION (connection)),
+ nm_connection_get_id (c),
error->message);
}
+ g_object_unref (c);
}
static void
@@ -3142,7 +3145,7 @@ import_cb (NMConnection *connection, gpointer user_data)
NMApplet *applet = user_data;
nm_connection_clear_secrets (connection);
- if (!nm_remote_settings_add_connection (applet->settings, connection, add_cb, NULL)) {
+ if (!nm_remote_settings_add_connection (applet->settings, connection, add_cb, g_object_ref (connection))) {
g_warning ("Failed to move connection '%s' to NetworkManager system settings.",
nm_connection_get_id (connection));
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]