# HG changeset patch
# User rosfran
# Date 1166563441 0
# Node ID 1c6948679ddf99d9182e65ab944d2e5b5cf27344
# Parent  5ed97410d052417af148c8bc08a028ab4be9922a
[svn r231] More memory clean-ups.

diff -r 5ed97410d052 -r 1c6948679ddf gmyth/src/gmyth_monitor_handler.c
--- a/gmyth/src/gmyth_monitor_handler.c	Tue Dec 19 21:02:12 2006 +0000
+++ b/gmyth/src/gmyth_monitor_handler.c	Tue Dec 19 21:24:01 2006 +0000
@@ -472,12 +472,6 @@
 {
   gboolean ret = TRUE;
 
-  /* Creates the event socket */
-  if (monitor->event_sock != NULL) {
-    g_object_unref (monitor->event_sock);
-    monitor->event_sock = NULL;
-  }
-
   monitor->event_sock = gmyth_socket_new();
 
   /* Connects the socket, send Mythtv ANN Monitor and verify Mythtv protocol version */ 
diff -r 5ed97410d052 -r 1c6948679ddf gmyth/src/gmyth_query.c
--- a/gmyth/src/gmyth_query.c	Tue Dec 19 21:02:12 2006 +0000
+++ b/gmyth/src/gmyth_query.c	Tue Dec 19 21:24:01 2006 +0000
@@ -79,7 +79,12 @@
     if (gmyth_query->backend_info) {
         g_object_unref (gmyth_query->backend_info);
 	//gmyth_query->backend_info = NULL;
-    }	    
+    }
+    
+    if ( gmyth_query != NULL )
+    {
+    	gmyth_query_disconnect (gmyth_query);
+    }
 
     G_OBJECT_CLASS (gmyth_query_parent_class)->dispose (object);
 }
diff -r 5ed97410d052 -r 1c6948679ddf gmyth/src/gmyth_socket.c
--- a/gmyth/src/gmyth_socket.c	Tue Dec 19 21:02:12 2006 +0000
+++ b/gmyth/src/gmyth_socket.c	Tue Dec 19 21:24:01 2006 +0000
@@ -307,7 +307,7 @@
 {
     GString *str = NULL;
     
-    if ( local_hostname != NULL )
+    if ( local_hostname != NULL && strlen(local_hostname) > 0 )
     	return g_string_new( local_hostname );
 
     gchar *localaddr = NULL; 
@@ -762,7 +762,7 @@
 	    g_string_free (result, TRUE);
 	}
 
-	g_string_free (hostname, FALSE);
+	g_string_free (hostname, TRUE);
 	g_string_free (base_str, TRUE);
 
 	return TRUE;