[svn r230] A lot of memory clean-ups.
1.1 --- a/gmyth/src/gmyth_livetv.c Tue Dec 19 19:48:04 2006 +0000
1.2 +++ b/gmyth/src/gmyth_livetv.c Tue Dec 19 21:02:12 2006 +0000
1.3 @@ -249,7 +249,7 @@
1.4
1.5 livetv->is_livetv = TRUE;
1.6
1.7 - livetv->local_hostname = gmyth_socket_get_local_hostname ( );
1.8 + livetv->local_hostname = gmyth_socket_get_local_hostname ();
1.9
1.10 if ( livetv->local_hostname == NULL ) {
1.11 res = FALSE;
1.12 @@ -321,6 +321,7 @@
1.13 res = FALSE;
1.14 goto error;
1.15 } else {
1.16 + res = TRUE;
1.17 gmyth_debug ("GMythLiveTV: All requests to backend to start TV were OK. [%s]\n", livetv->proginfo->pathname->str );
1.18 }
1.19
1.20 @@ -338,7 +339,7 @@
1.21 g_print( "[%s] ERROR running LiveTV setup.\n", __FUNCTION__ );
1.22
1.23 if ( livetv->local_hostname != NULL ) {
1.24 - g_string_free( livetv->local_hostname, TRUE );
1.25 + g_string_free( livetv->local_hostname, FALSE );
1.26 res = FALSE;
1.27 }
1.28
1.29 @@ -396,6 +397,7 @@
1.30 res = FALSE;
1.31 goto error;
1.32 } else {
1.33 + res = TRUE;
1.34 gmyth_debug ("[%s] GMythLiveTV: All requests to backend to start TV were OK, TV chain changed.\n", __FUNCTION__ );
1.35 }
1.36
1.37 @@ -407,7 +409,7 @@
1.38 g_print( "[%s] ERROR running LiveTV setup.\n", __FUNCTION__ );
1.39
1.40 if ( livetv->local_hostname != NULL ) {
1.41 - g_string_free( livetv->local_hostname, TRUE );
1.42 + g_string_free( livetv->local_hostname, FALSE );
1.43 res = FALSE;
1.44 }
1.45
1.46 @@ -456,8 +458,9 @@
1.47
1.48 uri = gmyth_uri_new_with_value( livetv->proginfo->pathname->str );
1.49 if ( NULL == uri )
1.50 - {
1.51 - gmyth_debug( "Couldn't parse the URI to start LiveTV! [ uri = %s ]", livetv->proginfo->pathname->str );
1.52 + {
1.53 + gmyth_debug( "Couldn't parse the URI to start LiveTV! [ uri = %s ]", livetv->proginfo->pathname->str );
1.54 + goto done;
1.55 }
1.56
1.57 if ( !gmyth_file_transfer_open( livetv->file_transfer, uri != NULL ? gmyth_uri_get_path(uri) :
2.1 --- a/gmyth/src/gmyth_monitor_handler.c Tue Dec 19 19:48:04 2006 +0000
2.2 +++ b/gmyth/src/gmyth_monitor_handler.c Tue Dec 19 21:02:12 2006 +0000
2.3 @@ -70,7 +70,7 @@
2.4 #define GMYTHTV_ENABLE_DEBUG 1
2.5 #endif
2.6
2.7 -GMainContext *io_watcher_context = NULL;
2.8 +//GMainContext *io_watcher_context = NULL;
2.9
2.10 //GThread *monitor_th = NULL;
2.11
2.12 @@ -82,12 +82,10 @@
2.13
2.14 static void gmyth_monitor_handler_default_listener( GMythMonitorHandler *monitor, gint msg_code, gchar* message,
2.15 gpointer live_tv, gpointer user_data );
2.16 -//static void gmyth_monitor_handler_listener (GMythMonitorHandler *monitor,
2.17 -// gpointer user_data);
2.18
2.19 static GMutex* mutex = NULL;
2.20
2.21 -static GCond* io_watcher_cond = NULL;
2.22 +//static GCond* io_watcher_cond = NULL;
2.23
2.24 static void gmyth_monitor_handler_class_init (GMythMonitorHandlerClass *klass);
2.25 static void gmyth_monitor_handler_init (GMythMonitorHandler *object);
2.26 @@ -141,13 +139,13 @@
2.27 monitor->port = 0;
2.28 monitor->actual_index = 0;
2.29
2.30 - monitor->backend_msgs = g_hash_table_new( g_int_hash, g_int_equal );
2.31 + //monitor->backend_msgs = g_hash_table_new( g_int_hash, g_int_equal );
2.32
2.33 /* it is used for signalizing the event socket consumer thread */
2.34 - io_watcher_cond = g_cond_new();
2.35 + //io_watcher_cond = g_cond_new();
2.36
2.37 /* mutex to control access to the event socket consumer thread */
2.38 - mutex = g_mutex_new();
2.39 + //mutex = g_mutex_new();
2.40
2.41 monitor->monitor_th = NULL;
2.42
2.43 @@ -193,11 +191,13 @@
2.44 mutex = NULL;
2.45 }
2.46
2.47 + /*
2.48 if ( io_watcher_cond != NULL )
2.49 {
2.50 g_cond_free( io_watcher_cond );
2.51 io_watcher_cond = NULL;
2.52 }
2.53 + */
2.54
2.55 G_OBJECT_CLASS (gmyth_monitor_handler_parent_class)->dispose (object);
2.56 }
2.57 @@ -270,9 +270,11 @@
2.58 }
2.59
2.60 gboolean
2.61 -gmyth_monitor_handler_open (GMythMonitorHandler *monitor, gchar *hostname, gint port)
2.62 +gmyth_monitor_handler_open (GMythMonitorHandler *monitor, const gchar *hostname, gint port)
2.63 {
2.64 gboolean ret = TRUE;
2.65 +
2.66 + g_return_val_if_fail( hostname != NULL, FALSE );
2.67
2.68 if (monitor->hostname != NULL) {
2.69 g_free (monitor->hostname);
3.1 --- a/gmyth/src/gmyth_monitor_handler.h Tue Dec 19 19:48:04 2006 +0000
3.2 +++ b/gmyth/src/gmyth_monitor_handler.h Tue Dec 19 21:02:12 2006 +0000
3.3 @@ -103,7 +103,7 @@
3.4
3.5 GMythMonitorHandler* gmyth_monitor_handler_new ( void );
3.6
3.7 -gboolean gmyth_monitor_handler_open (GMythMonitorHandler *monitor, gchar *hostname, gint port);
3.8 +gboolean gmyth_monitor_handler_open (GMythMonitorHandler *monitor, const gchar *hostname, gint port);
3.9
3.10 gboolean gmyth_monitor_handler_start (GMythMonitorHandler *monitor);
3.11
4.1 --- a/gmyth/src/gmyth_query.c Tue Dec 19 19:48:04 2006 +0000
4.2 +++ b/gmyth/src/gmyth_query.c Tue Dec 19 21:02:12 2006 +0000
4.3 @@ -78,7 +78,7 @@
4.4
4.5 if (gmyth_query->backend_info) {
4.6 g_object_unref (gmyth_query->backend_info);
4.7 - gmyth_query->backend_info = NULL;
4.8 + //gmyth_query->backend_info = NULL;
4.9 }
4.10
4.11 G_OBJECT_CLASS (gmyth_query_parent_class)->dispose (object);
5.1 --- a/gmyth/src/gmyth_socket.c Tue Dec 19 19:48:04 2006 +0000
5.2 +++ b/gmyth/src/gmyth_socket.c Tue Dec 19 21:02:12 2006 +0000
5.3 @@ -317,11 +317,10 @@
5.4 gchar localhostname[MAXHOSTNAMELEN];
5.5
5.6 if (gethostname (localhostname, MAXHOSTNAMELEN) != 0 ) {
5.7 - g_warning ("Error on gethostname");
5.8 + gmyth_debug ( "Error on gethostname" );
5.9 }
5.10 localhostname[MAXHOSTNAMELEN-1] = 0;
5.11
5.12 -
5.13 gint err = gmyth_socket_toaddrinfo (localhostname, -1, &addr_info_data );
5.14
5.15 if ( err == EADDRNOTAVAIL )
5.16 @@ -352,8 +351,10 @@
5.17
5.18 addr_info0 = addr_info0->ai_next;
5.19 };
5.20 +
5.21 freeaddrinfo (addr_info_data);
5.22 -
5.23 + addr_info_data = NULL;
5.24 +
5.25 if ( found_addr == FALSE ) {
5.26 gchar *prim_addr = gmyth_socket_get_primary_addr();
5.27
5.28 @@ -386,6 +387,10 @@
5.29
5.30 g_free (gmyth_socket->hostname);
5.31 gmyth_socket->hostname = NULL;
5.32 +
5.33 + g_free (local_hostname);
5.34 +
5.35 + local_hostname = NULL;
5.36
5.37 G_OBJECT_CLASS (gmyth_socket_parent_class)->dispose (object);
5.38 }