[svn r457] added check != NULL before g_string_free to avoid GLib Critical warnings
1.1 --- a/gmyth/src/gmyth_livetv.c Mon Mar 26 20:19:42 2007 +0100
1.2 +++ b/gmyth/src/gmyth_livetv.c Mon Mar 26 22:04:45 2007 +0100
1.3 @@ -141,8 +141,11 @@
1.4 g_mutex_free (livetv->mutex);
1.5 livetv->mutex = NULL;
1.6 }
1.7 -
1.8 - g_string_free (livetv->local_hostname, TRUE);
1.9 +
1.10 + if ( livetv->local_hostname != NULL ) {
1.11 + g_string_free (livetv->local_hostname, TRUE);
1.12 + livetv->local_hostname = NULL;
1.13 + }
1.14
1.15 G_OBJECT_CLASS (gmyth_livetv_parent_class)->dispose (object);
1.16 }
2.1 --- a/gmyth/src/gmyth_stringlist.c Mon Mar 26 20:19:42 2007 +0100
2.2 +++ b/gmyth/src/gmyth_stringlist.c Mon Mar 26 22:04:45 2007 +0100
2.3 @@ -358,7 +358,8 @@
2.4 static void
2.5 gmyth_string_list_clear_element( GString *str_elem, void *data_aux )
2.6 {
2.7 - g_string_free( str_elem, TRUE );
2.8 + if (str_elem != NULL)
2.9 + g_string_free( str_elem, TRUE );
2.10 }
2.11
2.12 /** Removes all strings from the string list.
3.1 --- a/gmyth/src/gmyth_tvchain.c Mon Mar 26 20:19:42 2007 +0100
3.2 +++ b/gmyth/src/gmyth_tvchain.c Mon Mar 26 22:04:45 2007 +0100
3.3 @@ -89,7 +89,10 @@
3.4 {
3.5 GMythTVChain *tvchain = GMYTH_TVCHAIN(object);
3.6
3.7 - g_string_free( tvchain->tvchain_id, TRUE );
3.8 + if (tvchain->tvchain_id != NULL) {
3.9 + g_string_free( tvchain->tvchain_id, TRUE );
3.10 + tvchain->tvchain_id = NULL;
3.11 + }
3.12
3.13 if ( tvchain->mutex != NULL ) {
3.14 g_mutex_free( tvchain->mutex );
3.15 @@ -101,7 +104,10 @@
3.16 g_list_free( tvchain->tvchain_list );
3.17 }
3.18
3.19 - g_string_free( tvchain->cur_chanid, TRUE );
3.20 + if (tvchain->cur_chanid != NULL) {
3.21 + g_string_free( tvchain->cur_chanid, TRUE );
3.22 + tvchain->cur_chanid = NULL;
3.23 + }
3.24
3.25 if ( tvchain->backend_info) {
3.26 g_object_unref (tvchain->backend_info);
3.27 @@ -405,13 +411,33 @@
3.28
3.29 entry = (struct LiveTVChainEntry *) data;
3.30
3.31 - g_string_free (entry->chanid, TRUE);
3.32 - g_free (entry->starttime);
3.33 - g_free (entry->endtime);
3.34 - g_string_free (entry->hostprefix, TRUE);
3.35 - g_string_free (entry->cardtype, TRUE);
3.36 - g_string_free (entry->channum, TRUE);
3.37 - g_string_free (entry->inputname, TRUE);
3.38 + if (entry->chanid != NULL) {
3.39 + g_string_free (entry->chanid, TRUE);
3.40 + }
3.41 +
3.42 + if (entry->starttime != NULL) {
3.43 + g_free (entry->starttime);
3.44 + }
3.45 +
3.46 + if (entry->endtime != NULL) {
3.47 + g_free (entry->endtime);
3.48 + }
3.49 +
3.50 + if (entry->hostprefix) {
3.51 + g_string_free (entry->hostprefix, TRUE);
3.52 + }
3.53 +
3.54 + if (entry->cardtype) {
3.55 + g_string_free (entry->cardtype, TRUE);
3.56 + }
3.57 +
3.58 + if (entry->channum) {
3.59 + g_string_free (entry->channum, TRUE);
3.60 + }
3.61 +
3.62 + if (entry->inputname) {
3.63 + g_string_free (entry->inputname, TRUE);
3.64 + }
3.65
3.66 g_free(entry);
3.67 }