mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager
synced 2024-09-06 09:04:55 +00:00
2006-08-04 Robert Love <rml@novell.com>
Glib Memory Slices! * configure.in: Require glib 2.10 or later. * src/NetworkManager.c, src/NetworkManagerAP.c, src/nm-ip4-config.c, src/NetworkManagerAPList.c, src/NetworkManagerDbus.c, src/NetworkManagerDbusUtils.c, src/nm-dbus-nmi.c, src/wpa.c, src/nm-device-802-11-wireless.c: Convert applicable g_malloc and g_new calls to g_slice_new. Likewise for g_free to g_slice_free. Memory Slices are the greatest thing since bread slices. * src/NetworkManagerAP.c: Also, fix memory leak. git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@1923 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
This commit is contained in:
parent
086ea42dc6
commit
e1620a9946
12
ChangeLog
12
ChangeLog
|
@ -1,3 +1,15 @@
|
|||
2006-08-04 Robert Love <rml@novell.com>
|
||||
|
||||
Glib Memory Slices!
|
||||
* configure.in: Require glib 2.10 or later.
|
||||
* src/NetworkManager.c, src/NetworkManagerAP.c, src/nm-ip4-config.c,
|
||||
src/NetworkManagerAPList.c, src/NetworkManagerDbus.c,
|
||||
src/NetworkManagerDbusUtils.c, src/nm-dbus-nmi.c, src/wpa.c,
|
||||
src/nm-device-802-11-wireless.c: Convert applicable g_malloc and
|
||||
g_new calls to g_slice_new. Likewise for g_free to g_slice_free.
|
||||
Memory Slices are the greatest thing since bread slices.
|
||||
* src/NetworkManagerAP.c: Also, fix memory leak.
|
||||
|
||||
2006-08-01 Robert Love <rml@novell.com>
|
||||
|
||||
* gnome/applet/main.c: Shutdown all VPN connections on logout.
|
||||
|
|
|
@ -139,7 +139,7 @@ PKG_CHECK_MODULES(GTHREAD, gthread-2.0)
|
|||
AC_SUBST(GTHREAD_CFLAGS)
|
||||
AC_SUBST(GTHREAD_LIBS)
|
||||
|
||||
PKG_CHECK_MODULES(GLIB, glib-2.0 >= 2.6)
|
||||
PKG_CHECK_MODULES(GLIB, glib-2.0 >= 2.10)
|
||||
AC_SUBST(GLIB_CFLAGS)
|
||||
AC_SUBST(GLIB_LIBS)
|
||||
|
||||
|
|
|
@ -425,7 +425,7 @@ static NMData *nm_data_new (gboolean enable_test_devices)
|
|||
NMData * data;
|
||||
GSource * iosource;
|
||||
|
||||
data = g_new0 (NMData, 1);
|
||||
data = g_slice_new0 (NMData);
|
||||
|
||||
data->main_context = g_main_context_new ();
|
||||
data->main_loop = g_main_loop_new (data->main_context, FALSE);
|
||||
|
@ -535,7 +535,7 @@ static void nm_data_free (NMData *data)
|
|||
|
||||
nm_hal_deinit (data);
|
||||
|
||||
memset (data, 0, sizeof (NMData));
|
||||
g_slice_free (NMData, data);
|
||||
}
|
||||
|
||||
int nm_get_sigterm_pipe (void)
|
||||
|
|
|
@ -84,7 +84,7 @@ NMAccessPoint * nm_ap_new (void)
|
|||
{
|
||||
NMAccessPoint *ap;
|
||||
|
||||
ap = g_malloc0 (sizeof (NMAccessPoint));
|
||||
ap = g_slice_new0 (NMAccessPoint);
|
||||
ap->mode = IW_MODE_INFRA;
|
||||
ap->refcount = 1;
|
||||
ap->capabilities = NM_802_11_CAP_PROTO_NONE;
|
||||
|
@ -160,7 +160,7 @@ void nm_ap_unref (NMAccessPoint *ap)
|
|||
g_object_unref (G_OBJECT (ap->security));
|
||||
|
||||
memset (ap, 0, sizeof (NMAccessPoint));
|
||||
g_free (ap);
|
||||
g_slice_free (NMAccessPoint, ap);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -662,6 +662,8 @@ void nm_ap_add_capabilities_from_ie (NMAccessPoint *ap, const guint8 *wpa_ie, gu
|
|||
caps |= NM_802_11_CAP_KEY_MGMT_PSK;
|
||||
|
||||
nm_ap_set_capabilities (ap, caps);
|
||||
|
||||
g_slice_free (wpa_ie_data, cap_data);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -46,16 +46,14 @@ struct NMAccessPointList
|
|||
*/
|
||||
NMAccessPointList *nm_ap_list_new (NMNetworkType type)
|
||||
{
|
||||
NMAccessPointList *list = g_new0 (NMAccessPointList, 1);
|
||||
|
||||
g_return_val_if_fail (list != NULL, NULL);
|
||||
NMAccessPointList *list = g_slice_new0 (NMAccessPointList);
|
||||
|
||||
nm_ap_list_ref (list);
|
||||
list->type = type;
|
||||
list->mutex = g_mutex_new ();
|
||||
if (!list->mutex)
|
||||
{
|
||||
g_free (list);
|
||||
g_slice_free (NMAccessPointList, list);
|
||||
nm_warning ("nm_ap_list_new() could not create list mutex");
|
||||
return (NULL);
|
||||
}
|
||||
|
@ -116,7 +114,7 @@ void nm_ap_list_unref (NMAccessPointList *list)
|
|||
nm_unlock_mutex (list->mutex, __FUNCTION__);
|
||||
|
||||
g_mutex_free (list->mutex);
|
||||
g_free(list);
|
||||
g_slice_free (NMAccessPointList, list);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -695,12 +693,11 @@ NMAPListIter * nm_ap_list_iter_new (NMAccessPointList *list)
|
|||
|
||||
g_return_val_if_fail (list != NULL, NULL);
|
||||
|
||||
if (!(iter = g_new0 (NMAPListIter, 1)))
|
||||
return (NULL);
|
||||
iter = g_slice_new (NMAPListIter);
|
||||
|
||||
if (!nm_ap_list_lock (list))
|
||||
{
|
||||
g_free (iter);
|
||||
g_slice_free (NMAPListIter, iter);
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
|
@ -745,7 +742,7 @@ void nm_ap_list_iter_free (NMAPListIter *iter)
|
|||
|
||||
nm_ap_list_unlock (iter->list);
|
||||
memset (iter, 0, sizeof (struct NMAPListIter));
|
||||
g_free (iter);
|
||||
g_slice_free (NMAPListIter, iter);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -251,7 +251,7 @@ static gboolean nm_dbus_signal_device_status_change (gpointer user_data)
|
|||
dbus_message_unref (message);
|
||||
|
||||
g_object_unref (G_OBJECT (cb_data->dev));
|
||||
g_free (cb_data);
|
||||
g_slice_free (NMStatusChangeData, cb_data);
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
@ -265,7 +265,7 @@ void nm_dbus_schedule_device_status_change_signal (NMData *data, NMDevice *dev,
|
|||
g_return_if_fail (data != NULL);
|
||||
g_return_if_fail (dev != NULL);
|
||||
|
||||
cb_data = g_malloc0 (sizeof (NMStatusChangeData));
|
||||
cb_data = g_slice_new0 (NMStatusChangeData);
|
||||
g_object_ref (G_OBJECT (dev));
|
||||
cb_data->data = data;
|
||||
cb_data->dev = dev;
|
||||
|
|
|
@ -32,7 +32,7 @@ struct NMDbusMethodList
|
|||
|
||||
NMDbusMethodList * nm_dbus_method_list_new (NMDbusMethod validate_method)
|
||||
{
|
||||
NMDbusMethodList *list = g_malloc0 (sizeof (NMDbusMethodList));
|
||||
NMDbusMethodList *list = g_slice_new0 (NMDbusMethodList);
|
||||
|
||||
list->validate_method = validate_method;
|
||||
list->methods = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL);
|
||||
|
@ -92,6 +92,6 @@ void nm_dbus_method_list_free (NMDbusMethodList *list)
|
|||
if (list)
|
||||
{
|
||||
g_hash_table_destroy (list->methods);
|
||||
g_free (list);
|
||||
g_slice_free (NMDbusMethodList, list);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -309,7 +309,7 @@ static void free_get_one_network_cb_data (GetOneNetworkCBData *data)
|
|||
data->list = NULL;
|
||||
data->network = NULL;
|
||||
data->data = NULL;
|
||||
g_free (data);
|
||||
g_slice_free (GetOneNetworkCBData, data);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -327,7 +327,7 @@ static void free_get_networks_cb_data (GetNetworksCBData *data)
|
|||
nm_ap_list_unref (data->list);
|
||||
data->data = NULL;
|
||||
data->list = NULL;
|
||||
g_free (data);
|
||||
g_slice_free (GetNetworksCBData, data);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -540,7 +540,7 @@ static void nm_dbus_get_networks_cb (DBusPendingCall *pcall, void *user_data)
|
|||
dbus_message_unref (message);
|
||||
if (net_pcall)
|
||||
{
|
||||
GetOneNetworkCBData * net_cb_data = g_malloc0 (sizeof (GetOneNetworkCBData));
|
||||
GetOneNetworkCBData * net_cb_data = g_slice_new0 (GetOneNetworkCBData);
|
||||
|
||||
net_cb_data->data = cb_data->data;
|
||||
net_cb_data->network = g_strdup (value);
|
||||
|
@ -584,7 +584,7 @@ void nm_dbus_update_allowed_networks (DBusConnection *connection, NMAccessPointL
|
|||
dbus_message_unref (message);
|
||||
if (pcall)
|
||||
{
|
||||
GetNetworksCBData * cb_data = g_malloc0 (sizeof (GetNetworksCBData));
|
||||
GetNetworksCBData * cb_data = g_slice_new0 (GetNetworksCBData);
|
||||
|
||||
cb_data->data = data;
|
||||
nm_ap_list_ref (list);
|
||||
|
@ -616,7 +616,7 @@ void nm_dbus_update_one_allowed_network (DBusConnection *connection, const char
|
|||
return;
|
||||
}
|
||||
|
||||
cb_data = g_malloc0 (sizeof (GetOneNetworkCBData));
|
||||
cb_data = g_slice_new0 (GetOneNetworkCBData);
|
||||
cb_data->data = data;
|
||||
cb_data->network = g_strdup (network);
|
||||
cb_data->list = data->allowed_ap_list;
|
||||
|
|
|
@ -535,7 +535,7 @@ wireless_event_helper (gpointer user_data)
|
|||
}
|
||||
g_object_unref (G_OBJECT (self));
|
||||
g_free (cb_data->data);
|
||||
g_free (cb_data);
|
||||
g_slice_free (WirelessEventCBData, cb_data);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
@ -553,7 +553,7 @@ nm_device_802_11_wireless_event (NmNetlinkMonitor *monitor,
|
|||
if (NM_DEVICE (self) != NM_DEVICE (obj))
|
||||
return;
|
||||
|
||||
cb_data = g_malloc0 (sizeof (WirelessEventCBData));
|
||||
cb_data = g_slice_new0 (WirelessEventCBData);
|
||||
cb_data->dev = self;
|
||||
g_object_ref (G_OBJECT (self));
|
||||
cb_data->data = g_malloc (data_len);
|
||||
|
@ -1815,7 +1815,7 @@ free_process_scan_cb_data (NMWirelessScanResults *cb_data)
|
|||
g_free (cb_data->results);
|
||||
g_object_unref (G_OBJECT (cb_data->dev));
|
||||
memset (cb_data, 0, sizeof (NMWirelessScanResults));
|
||||
g_free (cb_data);
|
||||
g_slice_free (NMWirelessScanResults, cb_data);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -1997,7 +1997,7 @@ request_and_convert_scan_results (NMDevice80211Wireless *self)
|
|||
* messages over DBUS. Plus, that way the main thread is the only thread that has
|
||||
* to modify the device's access point list.
|
||||
*/
|
||||
scan_results = g_malloc0 (sizeof (NMWirelessScanResults));
|
||||
scan_results = g_slice_new0 (NMWirelessScanResults);
|
||||
g_object_ref (G_OBJECT (self));
|
||||
scan_results->dev = self;
|
||||
scan_results->results = buf;
|
||||
|
|
|
@ -61,7 +61,7 @@ struct NMIP4Config
|
|||
|
||||
NMIP4Config *nm_ip4_config_new (void)
|
||||
{
|
||||
NMIP4Config *config = g_malloc0 (sizeof (NMIP4Config));
|
||||
NMIP4Config *config = g_slice_new0 (NMIP4Config);
|
||||
|
||||
config->refcount = 1;
|
||||
|
||||
|
@ -75,7 +75,7 @@ NMIP4Config *nm_ip4_config_copy (NMIP4Config *src_config)
|
|||
|
||||
g_return_val_if_fail (src_config != NULL, NULL);
|
||||
|
||||
dst_config = g_malloc0 (sizeof (NMIP4Config));
|
||||
dst_config = g_slice_new0 (NMIP4Config);
|
||||
dst_config->refcount = 1;
|
||||
|
||||
dst_config->ip4_address = nm_ip4_config_get_address (src_config);
|
||||
|
@ -124,7 +124,7 @@ void nm_ip4_config_unref (NMIP4Config *config)
|
|||
g_slist_free (config->nis_servers);
|
||||
|
||||
memset (config, 0, sizeof (NMIP4Config));
|
||||
g_free (config);
|
||||
g_slice_free (NMIP4Config, config);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -432,7 +432,7 @@ wpa_ie_data * wpa_parse_wpa_ie(const u8 *wpa_ie, size_t wpa_ie_len)
|
|||
if (!wpa_ie || wpa_ie_len <= 0)
|
||||
return NULL;
|
||||
|
||||
data = g_malloc0 (sizeof (wpa_ie_data));
|
||||
data = g_slice_new0 (wpa_ie_data);
|
||||
|
||||
if (wpa_ie_len >= 1 && wpa_ie[0] == WPA_RSN_INFO_ELEM)
|
||||
err = wpa_parse_wpa_ie_rsn(wpa_ie, wpa_ie_len, data);
|
||||
|
@ -441,7 +441,7 @@ wpa_ie_data * wpa_parse_wpa_ie(const u8 *wpa_ie, size_t wpa_ie_len)
|
|||
|
||||
if (err != 0)
|
||||
{
|
||||
g_free (data);
|
||||
g_slice_free (wpa_ie_data, data);
|
||||
data = NULL;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue