Commit 31027d4d authored by Chris Aillon's avatar Chris Aillon Committed by Chris Aillon
Browse files

2005-09-07 Christopher Aillon <caillon@redhat.com>

	* gnome/applet/menu-items.c:
	* gnome/applet/nm-device.c:
	* gnome/applet/wireless-network.c:
	* gnome/libnm_glib/libnm_glib.c:
	* src/NetworkManagerDbusUtils.c:
	* vpn-daemons/vpnc/src/nm-vpnc-service.c:
	g_malloc0 doesn't return NULL


git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@944 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
parent 949bd367
2005-09-07 Christopher Aillon <caillon@redhat.com>
* gnome/applet/menu-items.c:
* gnome/applet/nm-device.c:
* gnome/applet/wireless-network.c:
* gnome/libnm_glib/libnm_glib.c:
* src/NetworkManagerDbusUtils.c:
* vpn-daemons/vpnc/src/nm-vpnc-service.c:
g_malloc0 doesn't return NULL
2005-09-06 Dan Williams <dcbw@redhat.com>
Patch from Tomislav Vujec <tvujec@redhat.com>
......
......@@ -53,8 +53,6 @@ NMWiredMenuItem *wired_menu_item_new (void)
{
NMWiredMenuItem *item = g_malloc0 (sizeof (NMWiredMenuItem));
g_return_val_if_fail (item != NULL, NULL);
item->check_item = GTK_CHECK_MENU_ITEM (gtk_check_menu_item_new ());
item->label = GTK_LABEL (gtk_label_new (NULL));
gtk_misc_set_alignment (GTK_MISC (item->label), 0.0, 0.5);
......@@ -124,8 +122,6 @@ NMWirelessMenuItem *wireless_menu_item_new (void)
{
NMWirelessMenuItem *item = g_malloc0 (sizeof (NMWirelessMenuItem));
g_return_val_if_fail (item != NULL, NULL);
item->menu_item = GTK_MENU_ITEM (gtk_menu_item_new ());
/* Make sure it looks slightly different if the label determines the width of the widget */
......@@ -194,8 +190,6 @@ NMNetworkMenuItem *network_menu_item_new (GtkSizeGroup *encryption_size_group)
PangoLanguage *lang;
int ascent;
g_return_val_if_fail (item != NULL, NULL);
item->check_item = GTK_CHECK_MENU_ITEM (gtk_check_menu_item_new ());
gtk_check_menu_item_set_draw_as_radio (item->check_item, TRUE);
......
......@@ -56,15 +56,12 @@ struct NetworkDevice
*/
NetworkDevice *network_device_new (const char *iface, NMDeviceType type, const char *nm_path)
{
NetworkDevice *dev = NULL;
NetworkDevice *dev = g_malloc0 (sizeof (NetworkDevice));
if ((dev = g_malloc0 (sizeof (NetworkDevice))))
{
dev->refcount = 1;
dev->iface = g_strdup (iface);
dev->type = type;
dev->nm_path = g_strdup (nm_path);
}
dev->refcount = 1;
dev->iface = g_strdup (iface);
dev->type = type;
dev->nm_path = g_strdup (nm_path);
return dev;
}
......@@ -80,35 +77,33 @@ NetworkDevice *network_device_new (const char *iface, NMDeviceType type, const c
*/
NetworkDevice *network_device_copy (NetworkDevice *src)
{
NetworkDevice *dev = NULL;
NetworkDevice *dev;
GSList *elt;
g_return_val_if_fail (src != NULL, NULL);
if ((dev = g_malloc0 (sizeof (NetworkDevice))))
dev = g_malloc0 (sizeof (NetworkDevice));
network_device_ref (dev);
dev->nm_path = g_strdup (src->nm_path);
dev->type = src->type;
dev->link = src->link;
dev->addr = g_strdup (src->addr);
dev->driver_support_level = src->driver_support_level;
dev->iface = g_strdup (src->iface);
dev->desc = g_strdup (src->desc);
dev->udi = g_strdup (src->udi);
dev->active = src->active;
dev->act_stage = src->act_stage;
dev->strength = src->strength;
for (elt = src->networks; elt; elt = g_slist_next (elt))
{
GSList *elt;
network_device_ref (dev);
dev->nm_path = g_strdup (src->nm_path);
dev->type = src->type;
dev->link = src->link;
dev->addr = g_strdup (src->addr);
dev->driver_support_level = src->driver_support_level;
dev->iface = g_strdup (src->iface);
dev->desc = g_strdup (src->desc);
dev->udi = g_strdup (src->udi);
dev->active = src->active;
dev->act_stage = src->act_stage;
dev->strength = src->strength;
for (elt = src->networks; elt; elt = g_slist_next (elt))
WirelessNetwork *net = (WirelessNetwork *)elt->data;
if (net)
{
WirelessNetwork *net = (WirelessNetwork *)elt->data;
if (net)
{
WirelessNetwork *copy = wireless_network_copy (net);
dev->networks = g_slist_append (dev->networks, copy);
}
WirelessNetwork *copy = wireless_network_copy (net);
dev->networks = g_slist_append (dev->networks, copy);
}
}
......
......@@ -47,18 +47,16 @@ struct WirelessNetwork
*/
WirelessNetwork *wireless_network_new (const char *essid, const char *nm_path)
{
WirelessNetwork *net = NULL;
WirelessNetwork *net;
g_return_val_if_fail (essid != NULL, NULL);
g_return_val_if_fail (nm_path != NULL, NULL);
if ((net = g_malloc0 (sizeof (WirelessNetwork))))
{
net->essid = g_strdup (essid);
net->nm_path = g_strdup (nm_path);
}
net = g_malloc0 (sizeof (WirelessNetwork));
net->essid = g_strdup (essid);
net->nm_path = g_strdup (nm_path);
return (net);
return net;
}
......@@ -70,21 +68,19 @@ WirelessNetwork *wireless_network_new (const char *essid, const char *nm_path)
*/
WirelessNetwork *wireless_network_copy (WirelessNetwork *src)
{
WirelessNetwork *net = NULL;
WirelessNetwork *net;
g_return_val_if_fail (src != NULL, NULL);
if ((net = g_malloc0 (sizeof (WirelessNetwork))))
{
net->refcount = 1;
net->nm_path = g_strdup (src->nm_path);
net->essid = g_strdup (src->essid);
net->active = src->active;
net->encrypted = src->encrypted;
net->strength = src->strength;
}
net = g_malloc0 (sizeof (WirelessNetwork));
net->refcount = 1;
net->nm_path = g_strdup (src->nm_path);
net->essid = g_strdup (src->essid);
net->active = src->active;
net->encrypted = src->encrypted;
net->strength = src->strength;
return (net);
return net;
}
......
......@@ -411,9 +411,6 @@ static libnm_glib_ctx *libnm_glib_ctx_new (void)
{
libnm_glib_ctx *ctx = g_malloc0 (sizeof (libnm_glib_ctx));
if (!ctx)
return NULL;
if (!(ctx->g_main_ctx = g_main_context_new ()))
goto error;
if (!(ctx->g_main_loop = g_main_loop_new (ctx->g_main_ctx, FALSE)))
......@@ -500,8 +497,6 @@ gint libnm_glib_register_callback (libnm_glib_ctx *ctx, libnm_glib_callback_func
g_return_val_if_fail (func != NULL, -1);
callback = g_malloc0 (sizeof (libnm_glib_callback));
if (!callback)
return -1;
callback->id = ctx->callback_id_last++;
callback->func = func;
......
......@@ -34,11 +34,8 @@ NMDbusMethodList * nm_dbus_method_list_new (NMDbusMethod validate_method)
{
NMDbusMethodList *list = g_malloc0 (sizeof (NMDbusMethodList));
if (list)
{
list->validate_method = validate_method;
list->methods = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL);
}
list->validate_method = validate_method;
list->methods = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL);
return list;
}
......
......@@ -1127,11 +1127,8 @@ int main( int argc, char *argv[] )
if (!g_thread_supported ())
g_thread_init (NULL);
if (!(vpn_data = g_malloc0 (sizeof (NmVpncData))))
{
nm_warning ("Not enough memory to initialize.");
exit (1);
}
vpn_data = g_malloc0 (sizeof (NmVpncData));
vpn_data->state = NM_VPN_STATE_INIT;
vpn_data->loop = g_main_loop_new (NULL, FALSE);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment