diff options
author | David Zeuthen <davidz@redhat.com> | 2010-06-30 16:36:47 -0400 |
---|---|---|
committer | David Zeuthen <davidz@redhat.com> | 2010-06-30 16:39:32 -0400 |
commit | 21d7ce97c38bafa1fdbedc19fe9634bc3333e7c6 (patch) | |
tree | e2037809e46c9ed662d1c1b659208d474d5a2d93 /gio/gdbusauth.c | |
parent | 40d5da99d6d07bdbb6267f6b5625ac2ca93e85ea (diff) |
GDBus: plug some memory leaks
These fixes makes udisks-daemon from udisks' gdbus-port branch, see
http://cgit.freedesktop.org/udisks/log/?h=gdbus-port
handle 200 add/remove uevents generated by e.g.
#!/bin/bash
DEV=mmcblk0p1
for n in `seq 200` ; do
udevadm trigger --sysname-match=$DEV --action=remove
udevadm trigger --sysname-match=$DEV --action=add
echo foo $n
done
without any substantial leaks.
Signed-off-by: David Zeuthen <davidz@redhat.com>
Diffstat (limited to 'gio/gdbusauth.c')
-rw-r--r-- | gio/gdbusauth.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/gio/gdbusauth.c b/gio/gdbusauth.c index eeced636f..d3a754e45 100644 --- a/gio/gdbusauth.c +++ b/gio/gdbusauth.c @@ -607,6 +607,8 @@ _g_dbus_auth_run_client (GDBusAuth *auth, dis = G_DATA_INPUT_STREAM (g_data_input_stream_new (g_io_stream_get_input_stream (auth->priv->stream))); dos = G_DATA_OUTPUT_STREAM (g_data_output_stream_new (g_io_stream_get_output_stream (auth->priv->stream))); + g_filter_input_stream_set_close_base_stream (G_FILTER_INPUT_STREAM (dis), FALSE); + g_filter_output_stream_set_close_base_stream (G_FILTER_OUTPUT_STREAM (dos), FALSE); g_data_input_stream_set_newline_type (dis, G_DATA_STREAM_NEWLINE_TYPE_CR_LF); @@ -863,8 +865,8 @@ _g_dbus_auth_run_client (GDBusAuth *auth, g_object_unref (mech); g_ptr_array_unref (attempted_auth_mechs); g_strfreev (supported_auth_mechs); - g_object_ref (dis); - g_object_ref (dos); + g_object_unref (dis); + g_object_unref (dos); /* ensure return value is NULL if error is set */ if (error != NULL && *error != NULL) @@ -972,6 +974,8 @@ _g_dbus_auth_run_server (GDBusAuth *auth, dis = G_DATA_INPUT_STREAM (g_data_input_stream_new (g_io_stream_get_input_stream (auth->priv->stream))); dos = G_DATA_OUTPUT_STREAM (g_data_output_stream_new (g_io_stream_get_output_stream (auth->priv->stream))); + g_filter_input_stream_set_close_base_stream (G_FILTER_INPUT_STREAM (dis), FALSE); + g_filter_output_stream_set_close_base_stream (G_FILTER_OUTPUT_STREAM (dos), FALSE); g_data_input_stream_set_newline_type (dis, G_DATA_STREAM_NEWLINE_TYPE_CR_LF); @@ -1324,9 +1328,9 @@ _g_dbus_auth_run_server (GDBusAuth *auth, if (mech != NULL) g_object_unref (mech); if (dis != NULL) - g_object_ref (dis); - if (dis != NULL) - g_object_ref (dos); + g_object_unref (dis); + if (dos != NULL) + g_object_unref (dos); /* ensure return value is FALSE if error is set */ if (error != NULL && *error != NULL) |