diff --git a/libpurple/protocols/bonjour/xmpp.c b/libpurple/protocols/bonjour/xmpp.c
--- a/libpurple/protocols/bonjour/xmpp.c
+++ b/libpurple/protocols/bonjour/xmpp.c
@@ -569,8 +569,8 @@ bonjour_xmpp_send_stream_init(BonjourXMP
 		                          G_INPUT_STREAM(bconv->input),
 		                          G_OUTPUT_STREAM(bconv->output));
 		g_clear_object(&bconv->socket);
-		bconv->input = NULL;
-		bconv->output = NULL;
+		g_clear_object(&bconv->input);
+		g_clear_object(&bconv->output);
 		g_free(stream_start);
 
 		return FALSE;
@@ -633,8 +633,8 @@ bonjour_xmpp_stream_started(BonjourXMPPC
 		                          G_INPUT_STREAM(bconv->input),
 		                          G_OUTPUT_STREAM(bconv->output));
 		g_clear_object(&bconv->socket);
-		bconv->input = NULL;
-		bconv->output = NULL;
+		g_clear_object(&bconv->input);
+		g_clear_object(&bconv->output);
 
 		/* This must be asynchronous because it destroys the parser and we
 		 * may be in the middle of parsing.
@@ -716,9 +716,10 @@ static void
 
 	/* We wait for the stream start before doing anything else */
 	bconv->socket = g_object_ref(connection);
-	bconv->input = g_io_stream_get_input_stream(G_IO_STREAM(bconv->socket));
-	bconv->output =
-	        g_io_stream_get_output_stream(G_IO_STREAM(bconv->socket));
+	bconv->input = g_object_ref(
+	        g_io_stream_get_input_stream(G_IO_STREAM(bconv->socket)));
+	bconv->output = g_object_ref(
+	        g_io_stream_get_output_stream(G_IO_STREAM(bconv->socket)));
 	source = g_pollable_input_stream_create_source(
 	        G_POLLABLE_INPUT_STREAM(bconv->input), bconv->cancellable);
 	g_source_set_callback(source, (GSourceFunc)_client_socket_handler,
@@ -845,9 +846,9 @@ static void
 
 	bb->conversation->socket = conn;
 	bb->conversation->input =
-	        g_io_stream_get_input_stream(G_IO_STREAM(conn));
+	        g_object_ref(g_io_stream_get_input_stream(G_IO_STREAM(conn)));
 	bb->conversation->output =
-	        g_io_stream_get_output_stream(G_IO_STREAM(conn));
+	        g_object_ref(g_io_stream_get_output_stream(G_IO_STREAM(conn)));
 
 	if (!bonjour_xmpp_send_stream_init(bb->conversation, &error)) {
 		PurpleConversation *conv = NULL;
@@ -1168,8 +1169,8 @@ bonjour_xmpp_close_conversation(BonjourX
 
 	/* Free all the data related to the conversation */
 	g_clear_object(&bconv->socket);
-	bconv->input = NULL;
-	bconv->output = NULL;
+	g_clear_object(&bconv->input);
+	g_clear_object(&bconv->output);
 
 	g_object_unref(G_OBJECT(bconv->tx_buf));
 	if (bconv->stream_data != NULL) {
diff --git a/libpurple/protocols/jabber/jabber.c b/libpurple/protocols/jabber/jabber.c
--- a/libpurple/protocols/jabber/jabber.c
+++ b/libpurple/protocols/jabber/jabber.c
@@ -721,7 +721,7 @@ jabber_stream_connect_finish(JabberStrea
 	GSource *source;
 
 	js->stream = stream;
-	js->input = g_io_stream_get_input_stream(js->stream);
+	js->input = g_object_ref(g_io_stream_get_input_stream(js->stream));
 	js->output = purple_queued_output_stream_new(
 	        g_io_stream_get_output_stream(js->stream));
 
diff --git a/libpurple/protocols/novell/novell.c b/libpurple/protocols/novell/novell.c
--- a/libpurple/protocols/novell/novell.c
+++ b/libpurple/protocols/novell/novell.c
@@ -1727,7 +1727,7 @@ novell_login_callback(GObject *source_ob
 	conn->stream = G_IO_STREAM(sockconn);
 	conn->input =
 	        g_data_input_stream_new(g_io_stream_get_input_stream(conn->stream));
-	conn->output = g_io_stream_get_output_stream(conn->stream);
+	conn->output = g_object_ref(g_io_stream_get_output_stream(conn->stream));
 
 	g_data_input_stream_set_byte_order(conn->input,
 	                                   G_DATA_STREAM_BYTE_ORDER_LITTLE_ENDIAN);
diff --git a/libpurple/protocols/sametime/sametime.c b/libpurple/protocols/sametime/sametime.c
--- a/libpurple/protocols/sametime/sametime.c
+++ b/libpurple/protocols/sametime/sametime.c
@@ -1749,7 +1749,7 @@ connect_cb(GObject *source_object, GAsyn
   }
 
   pd->stream = G_IO_STREAM(sockconn);
-  pd->input = g_io_stream_get_input_stream(pd->stream);
+  pd->input = g_object_ref(g_io_stream_get_input_stream(pd->stream));
   pd->output = purple_queued_output_stream_new(
           g_io_stream_get_output_stream(pd->stream));
   source = g_pollable_input_stream_create_source(
@@ -3095,7 +3095,7 @@ static void mwPurpleProtocolData_free(st
 
   g_clear_object(&pd->cancellable);
   g_hash_table_destroy(pd->group_list_map);
-  pd->input = NULL;
+  g_clear_object(&pd->input);
   g_clear_object(&pd->output);
   g_clear_object(&pd->stream);
 
