merge: fix errors found with valgrind
A handful of memory leaks and one read-after-free().
This commit is contained in:
@@ -873,13 +873,13 @@ VAPIGEN_CHECK(0.17.1.24)
|
|||||||
|
|
||||||
# Tests, utilities and documentation
|
# Tests, utilities and documentation
|
||||||
AC_ARG_ENABLE(tests, AS_HELP_STRING([--enable-tests=root|yes|no], [Build NetworkManager tests (default: yes)]))
|
AC_ARG_ENABLE(tests, AS_HELP_STRING([--enable-tests=root|yes|no], [Build NetworkManager tests (default: yes)]))
|
||||||
AC_ARG_WITH(valgrind, AS_HELP_STRING([--with-valgrind=yes|no|path], [Use valgrind to memory-check the tests (default: yes)]))
|
AC_ARG_WITH(valgrind, AS_HELP_STRING([--with-valgrind=yes|no|path], [Use valgrind to memory-check the tests (default: no)]))
|
||||||
# Fallback to --with-tests
|
# Fallback to --with-tests
|
||||||
AC_ARG_WITH(tests, AS_HELP_STRING([--with-tests], [Build NetworkManager tests (deprecated)]))
|
AC_ARG_WITH(tests, AS_HELP_STRING([--with-tests], [Build NetworkManager tests (deprecated)]))
|
||||||
AS_IF([test -n "$with_tests"], enable_tests="$with_tests")
|
AS_IF([test -n "$with_tests"], enable_tests="$with_tests")
|
||||||
# Default to --enable-tests --with-valgrind
|
# Default to --enable-tests --with-valgrind=no
|
||||||
AS_IF([test -z "$enable_tests"], enable_tests="yes")
|
AS_IF([test -z "$enable_tests"], enable_tests="yes")
|
||||||
AS_IF([test -z "$with_valgrind"], with_valgrind="yes")
|
AS_IF([test -z "$with_valgrind"], with_valgrind="no")
|
||||||
# Normalize values
|
# Normalize values
|
||||||
AS_IF([test "$enable_tests" != "yes" -a "$enable_tests" != "root"], enable_tests="no")
|
AS_IF([test "$enable_tests" != "yes" -a "$enable_tests" != "root"], enable_tests="no")
|
||||||
# Search for tools
|
# Search for tools
|
||||||
|
@@ -884,6 +884,8 @@ dispose (GObject *object)
|
|||||||
timeout_cleanup (self);
|
timeout_cleanup (self);
|
||||||
|
|
||||||
g_clear_pointer (&priv->iface, g_free);
|
g_clear_pointer (&priv->iface, g_free);
|
||||||
|
g_clear_pointer (&priv->hostname, g_free);
|
||||||
|
g_clear_pointer (&priv->uuid, g_free);
|
||||||
|
|
||||||
if (priv->hwaddr) {
|
if (priv->hwaddr) {
|
||||||
g_byte_array_free (priv->hwaddr, TRUE);
|
g_byte_array_free (priv->hwaddr, TRUE);
|
||||||
|
@@ -158,17 +158,18 @@ nm_auth_chain_steal_data (NMAuthChain *self, const char *tag)
|
|||||||
{
|
{
|
||||||
ChainData *tmp;
|
ChainData *tmp;
|
||||||
gpointer value = NULL;
|
gpointer value = NULL;
|
||||||
|
void *orig_key;
|
||||||
|
|
||||||
g_return_val_if_fail (self != NULL, NULL);
|
g_return_val_if_fail (self != NULL, NULL);
|
||||||
g_return_val_if_fail (tag != NULL, NULL);
|
g_return_val_if_fail (tag != NULL, NULL);
|
||||||
|
|
||||||
tmp = g_hash_table_lookup (self->data, tag);
|
if (g_hash_table_lookup_extended (self->data, tag, &orig_key, (gpointer)&tmp)) {
|
||||||
if (tmp) {
|
|
||||||
g_hash_table_steal (self->data, tag);
|
g_hash_table_steal (self->data, tag);
|
||||||
value = tmp->data;
|
value = tmp->data;
|
||||||
/* Make sure the destroy handler isn't called when freeing */
|
/* Make sure the destroy handler isn't called when freeing */
|
||||||
tmp->destroy = NULL;
|
tmp->destroy = NULL;
|
||||||
free_data (tmp);
|
free_data (tmp);
|
||||||
|
g_free (orig_key);
|
||||||
}
|
}
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
@@ -186,6 +186,7 @@ nm_connectivity_check_cb (SoupSession *session, SoupMessage *msg, gpointer user_
|
|||||||
|
|
||||||
g_simple_async_result_set_op_res_gssize (simple, new_state);
|
g_simple_async_result_set_op_res_gssize (simple, new_state);
|
||||||
g_simple_async_result_complete (simple);
|
g_simple_async_result_complete (simple);
|
||||||
|
g_object_unref (simple);
|
||||||
|
|
||||||
g_free (cb_data->uri);
|
g_free (cb_data->uri);
|
||||||
g_free (cb_data->response);
|
g_free (cb_data->response);
|
||||||
@@ -321,6 +322,7 @@ nm_connectivity_check_async (NMConnectivity *self,
|
|||||||
|
|
||||||
g_simple_async_result_set_op_res_gssize (simple, priv->state);
|
g_simple_async_result_set_op_res_gssize (simple, priv->state);
|
||||||
g_simple_async_result_complete_in_idle (simple);
|
g_simple_async_result_complete_in_idle (simple);
|
||||||
|
g_object_unref (simple);
|
||||||
}
|
}
|
||||||
|
|
||||||
NMConnectivityState
|
NMConnectivityState
|
||||||
|
@@ -5112,6 +5112,7 @@ dispose (GObject *object)
|
|||||||
}
|
}
|
||||||
|
|
||||||
g_clear_object (&priv->settings);
|
g_clear_object (&priv->settings);
|
||||||
|
g_free (priv->state_file);
|
||||||
g_clear_object (&priv->vpn_manager);
|
g_clear_object (&priv->vpn_manager);
|
||||||
|
|
||||||
/* Unregister property filter */
|
/* Unregister property filter */
|
||||||
|
@@ -1008,7 +1008,7 @@ init_link (NMPlatform *platform, NMPlatformLink *info, struct rtnl_link *rtnllin
|
|||||||
if (udev_device) {
|
if (udev_device) {
|
||||||
info->driver = udev_get_driver (platform, udev_device, info->ifindex);
|
info->driver = udev_get_driver (platform, udev_device, info->ifindex);
|
||||||
if (!info->driver)
|
if (!info->driver)
|
||||||
info->driver = rtnl_link_get_type (rtnllink);
|
info->driver = g_intern_string (rtnl_link_get_type (rtnllink));
|
||||||
if (!info->driver)
|
if (!info->driver)
|
||||||
info->driver = ethtool_get_driver (info->name);
|
info->driver = ethtool_get_driver (info->name);
|
||||||
if (!info->driver)
|
if (!info->driver)
|
||||||
|
@@ -720,6 +720,7 @@ dispose (GObject *object)
|
|||||||
g_clear_pointer (&priv->event_channel, g_io_channel_unref);
|
g_clear_pointer (&priv->event_channel, g_io_channel_unref);
|
||||||
|
|
||||||
if (priv->ndp) {
|
if (priv->ndp) {
|
||||||
|
ndp_msgrcv_handler_unregister (priv->ndp, receive_ra, NDP_MSG_RA, NM_RDISC (rdisc)->ifindex, rdisc);
|
||||||
ndp_close (priv->ndp);
|
ndp_close (priv->ndp);
|
||||||
priv->ndp = NULL;
|
priv->ndp = NULL;
|
||||||
}
|
}
|
||||||
|
@@ -318,6 +318,7 @@ impl_agent_manager_register_with_capabilities (NMAgentManager *self,
|
|||||||
|
|
||||||
priv->chains = g_slist_append (priv->chains, chain);
|
priv->chains = g_slist_append (priv->chains, chain);
|
||||||
} else {
|
} else {
|
||||||
|
g_object_unref (agent);
|
||||||
error = g_error_new_literal (NM_AGENT_MANAGER_ERROR,
|
error = g_error_new_literal (NM_AGENT_MANAGER_ERROR,
|
||||||
NM_AGENT_MANAGER_ERROR_FAILED,
|
NM_AGENT_MANAGER_ERROR_FAILED,
|
||||||
"Unable to start agent authentication.");
|
"Unable to start agent authentication.");
|
||||||
@@ -585,11 +586,12 @@ request_next_agent (Request *req)
|
|||||||
{
|
{
|
||||||
GError *error = NULL;
|
GError *error = NULL;
|
||||||
|
|
||||||
if (req->pending) {
|
|
||||||
/* Send the request to the next agent */
|
|
||||||
req->current_call_id = NULL;
|
req->current_call_id = NULL;
|
||||||
if (req->current)
|
if (req->current)
|
||||||
g_object_unref (req->current);
|
g_object_unref (req->current);
|
||||||
|
|
||||||
|
if (req->pending) {
|
||||||
|
/* Send the request to the next agent */
|
||||||
req->current = req->pending->data;
|
req->current = req->pending->data;
|
||||||
req->pending = g_slist_remove (req->pending, req->current);
|
req->pending = g_slist_remove (req->pending, req->current);
|
||||||
|
|
||||||
@@ -599,7 +601,6 @@ request_next_agent (Request *req)
|
|||||||
|
|
||||||
req->next_callback (req);
|
req->next_callback (req);
|
||||||
} else {
|
} else {
|
||||||
req->current_call_id = NULL;
|
|
||||||
req->current = NULL;
|
req->current = NULL;
|
||||||
|
|
||||||
/* No more secret agents are available to fulfill this secrets request */
|
/* No more secret agents are available to fulfill this secrets request */
|
||||||
|
@@ -2314,6 +2314,8 @@ dispose (GObject *object)
|
|||||||
}
|
}
|
||||||
g_clear_object (&priv->agent_mgr);
|
g_clear_object (&priv->agent_mgr);
|
||||||
|
|
||||||
|
g_clear_pointer (&priv->filename, g_free);
|
||||||
|
|
||||||
G_OBJECT_CLASS (nm_settings_connection_parent_class)->dispose (object);
|
G_OBJECT_CLASS (nm_settings_connection_parent_class)->dispose (object);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user