# HG changeset patch # User renatofilho # Date 1175113602 -3600 # Node ID f4c6061f6f392c2c482afb0f66c54cbc7675728d # Parent bc13aaf7561d4230974089f4de4885d1091a0a3d [svn r473] memory leek fix diff -r bc13aaf7561d -r f4c6061f6f39 gmyth/src/gmyth_livetv.c --- a/gmyth/src/gmyth_livetv.c Wed Mar 28 15:53:29 2007 +0100 +++ b/gmyth/src/gmyth_livetv.c Wed Mar 28 21:26:42 2007 +0100 @@ -470,7 +470,7 @@ } /* if - changes the channel number */ - //sleep (1); /* FIXME: this is evil (tpm) */ + sleep (5); /* FIXME: this is evil (tpm) */ } /* DEBUG message */ @@ -549,12 +549,14 @@ g_mutex_unlock( livetv->mutex ); +/* if ( !gmyth_livetv_monitor_handler_start( livetv ) ) { res = FALSE; gmyth_debug( "LiveTV MONITOR handler error on setup!" ); goto error; } +*/ livetv->setup_done = TRUE; diff -r bc13aaf7561d -r f4c6061f6f39 gmyth/src/gmyth_socket.c --- a/gmyth/src/gmyth_socket.c Wed Mar 28 15:53:29 2007 +0100 +++ b/gmyth/src/gmyth_socket.c Wed Mar 28 21:26:42 2007 +0100 @@ -492,7 +492,7 @@ const gchar *hostname, gint port, guint timeout) { struct addrinfo *addr_info_data = NULL, *addr_info0 = NULL; - struct linger* ling = NULL; + struct linger ling; gchar *tmp_str; gint ret_code = 0; /* -1 */ /* FIXME: add as function parameter */ @@ -564,12 +564,13 @@ g_io_channel_unref (gmyth_socket->sd_io_ch); gmyth_socket->sd_io_ch = NULL; } + + + memset (&ling, 0, sizeof (struct linger)); + ling.l_onoff = TRUE; + ling.l_linger = 1; - ling = g_malloc0( sizeof(struct linger) ); - ling->l_onoff = TRUE; - ling->l_linger = 1; - - err = setsockopt(gmyth_socket->sd, SOL_SOCKET, SO_LINGER, ling, sizeof(struct linger)); + err = setsockopt(gmyth_socket->sd, SOL_SOCKET, SO_LINGER, &ling, sizeof(struct linger)); if( err < 0 ) { gmyth_debug( "[%s] Setting connection unsucessfull.\n", __FUNCTION__ ); @@ -593,9 +594,6 @@ ret = ( ret_code == 0 ) ? TRUE : FALSE ; cleanup: - if ( !ling ) - g_free (ling); - if ( !ret ) gmyth_debug("GMythSocket error - return code error!"); @@ -1111,7 +1109,7 @@ g_free (str_array); /* ptr_array is pointing to data inside str_list->glist */ - g_ptr_array_free (ptr_array, FALSE); + g_ptr_array_free (ptr_array, TRUE); return TRUE; } diff -r bc13aaf7561d -r f4c6061f6f39 gmyth/src/gmyth_util.c --- a/gmyth/src/gmyth_util.c Wed Mar 28 15:53:29 2007 +0100 +++ b/gmyth/src/gmyth_util.c Wed Mar 28 21:26:42 2007 +0100 @@ -122,19 +122,19 @@ if ( NULL == localtime_r( &time, tm_time ) ) { g_warning ("gmyth_util_time_to_isoformat convertion error!\n"); - } else { - /* we first check the return of strftime to allocate a buffer of the correct size */ - buffer_len = strftime( NULL, SSIZE_MAX, fmt_string, tm_time ); - if ( buffer_len > 0 ) { - result = g_malloc0( buffer_len + 1 ); - if( result == NULL ) { - g_static_mutex_unlock ( &mutex ); - g_warning ("gmyth_util_time_to_isoformat convertion error!\n"); - return NULL; - } - strftime( result, buffer_len + 1, fmt_string, tm_time ); - gmyth_debug( "Dateline (ISO result): %s", result ); - } + } else { + /* we first check the return of strftime to allocate a buffer of the correct size */ + buffer_len = strftime( NULL, SSIZE_MAX, fmt_string, tm_time ); + if ( buffer_len > 0 ) { + result = g_malloc0( buffer_len + 1 ); + if( result == NULL ) { + g_static_mutex_unlock ( &mutex ); + g_warning ("gmyth_util_time_to_isoformat convertion error!\n"); + return NULL; + } + strftime( result, buffer_len + 1, fmt_string, tm_time ); + gmyth_debug( "Dateline (ISO result): %s", result ); + } } /* if */ gmyth_debug( "Result (strftime) = %s", result ); @@ -143,7 +143,7 @@ //strftime( result, strlen(result), fmt_string, tm_time ); - g_free (tm_time); + g_free (tm_time); g_static_mutex_unlock ( &mutex ); @@ -377,6 +377,7 @@ gmyth_debug( "After mktime call... = %s", asctime(tm_time) ); g_static_mutex_unlock ( &mutex ); + g_free (tm_time); return time; }