# HG changeset patch # User rosfran # Date 1166562132 0 # Node ID 5ed97410d052417af148c8bc08a028ab4be9922a # Parent 0c4b132db3e790a2b291ae0046f38b4ec1021f86 [svn r230] A lot of memory clean-ups. diff -r 0c4b132db3e7 -r 5ed97410d052 gmyth/src/gmyth_livetv.c --- a/gmyth/src/gmyth_livetv.c Tue Dec 19 19:48:04 2006 +0000 +++ b/gmyth/src/gmyth_livetv.c Tue Dec 19 21:02:12 2006 +0000 @@ -249,7 +249,7 @@ livetv->is_livetv = TRUE; - livetv->local_hostname = gmyth_socket_get_local_hostname ( ); + livetv->local_hostname = gmyth_socket_get_local_hostname (); if ( livetv->local_hostname == NULL ) { res = FALSE; @@ -321,6 +321,7 @@ res = FALSE; goto error; } else { + res = TRUE; gmyth_debug ("GMythLiveTV: All requests to backend to start TV were OK. [%s]\n", livetv->proginfo->pathname->str ); } @@ -338,7 +339,7 @@ g_print( "[%s] ERROR running LiveTV setup.\n", __FUNCTION__ ); if ( livetv->local_hostname != NULL ) { - g_string_free( livetv->local_hostname, TRUE ); + g_string_free( livetv->local_hostname, FALSE ); res = FALSE; } @@ -396,6 +397,7 @@ res = FALSE; goto error; } else { + res = TRUE; gmyth_debug ("[%s] GMythLiveTV: All requests to backend to start TV were OK, TV chain changed.\n", __FUNCTION__ ); } @@ -407,7 +409,7 @@ g_print( "[%s] ERROR running LiveTV setup.\n", __FUNCTION__ ); if ( livetv->local_hostname != NULL ) { - g_string_free( livetv->local_hostname, TRUE ); + g_string_free( livetv->local_hostname, FALSE ); res = FALSE; } @@ -456,8 +458,9 @@ uri = gmyth_uri_new_with_value( livetv->proginfo->pathname->str ); if ( NULL == uri ) - { - gmyth_debug( "Couldn't parse the URI to start LiveTV! [ uri = %s ]", livetv->proginfo->pathname->str ); + { + gmyth_debug( "Couldn't parse the URI to start LiveTV! [ uri = %s ]", livetv->proginfo->pathname->str ); + goto done; } if ( !gmyth_file_transfer_open( livetv->file_transfer, uri != NULL ? gmyth_uri_get_path(uri) : diff -r 0c4b132db3e7 -r 5ed97410d052 gmyth/src/gmyth_monitor_handler.c --- a/gmyth/src/gmyth_monitor_handler.c Tue Dec 19 19:48:04 2006 +0000 +++ b/gmyth/src/gmyth_monitor_handler.c Tue Dec 19 21:02:12 2006 +0000 @@ -70,7 +70,7 @@ #define GMYTHTV_ENABLE_DEBUG 1 #endif -GMainContext *io_watcher_context = NULL; +//GMainContext *io_watcher_context = NULL; //GThread *monitor_th = NULL; @@ -82,12 +82,10 @@ static void gmyth_monitor_handler_default_listener( GMythMonitorHandler *monitor, gint msg_code, gchar* message, gpointer live_tv, gpointer user_data ); -//static void gmyth_monitor_handler_listener (GMythMonitorHandler *monitor, -// gpointer user_data); static GMutex* mutex = NULL; -static GCond* io_watcher_cond = NULL; +//static GCond* io_watcher_cond = NULL; static void gmyth_monitor_handler_class_init (GMythMonitorHandlerClass *klass); static void gmyth_monitor_handler_init (GMythMonitorHandler *object); @@ -141,13 +139,13 @@ monitor->port = 0; monitor->actual_index = 0; - monitor->backend_msgs = g_hash_table_new( g_int_hash, g_int_equal ); + //monitor->backend_msgs = g_hash_table_new( g_int_hash, g_int_equal ); /* it is used for signalizing the event socket consumer thread */ - io_watcher_cond = g_cond_new(); + //io_watcher_cond = g_cond_new(); /* mutex to control access to the event socket consumer thread */ - mutex = g_mutex_new(); + //mutex = g_mutex_new(); monitor->monitor_th = NULL; @@ -193,11 +191,13 @@ mutex = NULL; } + /* if ( io_watcher_cond != NULL ) { g_cond_free( io_watcher_cond ); io_watcher_cond = NULL; } + */ G_OBJECT_CLASS (gmyth_monitor_handler_parent_class)->dispose (object); } @@ -270,9 +270,11 @@ } gboolean -gmyth_monitor_handler_open (GMythMonitorHandler *monitor, gchar *hostname, gint port) +gmyth_monitor_handler_open (GMythMonitorHandler *monitor, const gchar *hostname, gint port) { gboolean ret = TRUE; + + g_return_val_if_fail( hostname != NULL, FALSE ); if (monitor->hostname != NULL) { g_free (monitor->hostname); diff -r 0c4b132db3e7 -r 5ed97410d052 gmyth/src/gmyth_monitor_handler.h --- a/gmyth/src/gmyth_monitor_handler.h Tue Dec 19 19:48:04 2006 +0000 +++ b/gmyth/src/gmyth_monitor_handler.h Tue Dec 19 21:02:12 2006 +0000 @@ -103,7 +103,7 @@ GMythMonitorHandler* gmyth_monitor_handler_new ( void ); -gboolean gmyth_monitor_handler_open (GMythMonitorHandler *monitor, gchar *hostname, gint port); +gboolean gmyth_monitor_handler_open (GMythMonitorHandler *monitor, const gchar *hostname, gint port); gboolean gmyth_monitor_handler_start (GMythMonitorHandler *monitor); diff -r 0c4b132db3e7 -r 5ed97410d052 gmyth/src/gmyth_query.c --- a/gmyth/src/gmyth_query.c Tue Dec 19 19:48:04 2006 +0000 +++ b/gmyth/src/gmyth_query.c Tue Dec 19 21:02:12 2006 +0000 @@ -78,7 +78,7 @@ if (gmyth_query->backend_info) { g_object_unref (gmyth_query->backend_info); - gmyth_query->backend_info = NULL; + //gmyth_query->backend_info = NULL; } G_OBJECT_CLASS (gmyth_query_parent_class)->dispose (object); diff -r 0c4b132db3e7 -r 5ed97410d052 gmyth/src/gmyth_socket.c --- a/gmyth/src/gmyth_socket.c Tue Dec 19 19:48:04 2006 +0000 +++ b/gmyth/src/gmyth_socket.c Tue Dec 19 21:02:12 2006 +0000 @@ -317,11 +317,10 @@ gchar localhostname[MAXHOSTNAMELEN]; if (gethostname (localhostname, MAXHOSTNAMELEN) != 0 ) { - g_warning ("Error on gethostname"); + gmyth_debug ( "Error on gethostname" ); } localhostname[MAXHOSTNAMELEN-1] = 0; - gint err = gmyth_socket_toaddrinfo (localhostname, -1, &addr_info_data ); if ( err == EADDRNOTAVAIL ) @@ -352,8 +351,10 @@ addr_info0 = addr_info0->ai_next; }; + freeaddrinfo (addr_info_data); - + addr_info_data = NULL; + if ( found_addr == FALSE ) { gchar *prim_addr = gmyth_socket_get_primary_addr(); @@ -386,6 +387,10 @@ g_free (gmyth_socket->hostname); gmyth_socket->hostname = NULL; + + g_free (local_hostname); + + local_hostname = NULL; G_OBJECT_CLASS (gmyth_socket_parent_class)->dispose (object); }