diff stream/stream_dvb.c @ 32511:b39155e98ac3

Remove some useless NULL pointer checks before invoking free() on the pointer. patch by From: Clment Bsch, ubitux gmail com
author diego
date Sun, 07 Nov 2010 12:47:40 +0000
parents 20e5447d78f9
children 04dc3e55cd90
line wrap: on
line diff
--- a/stream/stream_dvb.c	Sun Nov 07 11:03:47 2010 +0000
+++ b/stream/stream_dvb.c	Sun Nov 07 12:47:40 2010 +0000
@@ -403,8 +403,7 @@
 	fclose(f);
 	if(list->NUM_CHANNELS == 0)
 	{
-		if(list->channels != NULL)
-			free(list->channels);
+		free(list->channels);
 		free(list);
 		return NULL;
 	}
@@ -419,17 +418,13 @@
 
 	for(i=0; i<config->count; i++)
 	{
-		if(config->cards[i].name)
-			free(config->cards[i].name);
+		free(config->cards[i].name);
 		if(!config->cards[i].list)
 			continue;
 		if(config->cards[i].list->channels)
 		{
 			for(j=0; j<config->cards[i].list->NUM_CHANNELS; j++)
-			{
-				if(config->cards[i].list->channels[j].name)
-					free(config->cards[i].list->channels[j].name);
-			}
+				free(config->cards[i].list->channels[j].name);
 			free(config->cards[i].list->channels);
 		}
 		free(config->cards[i].list);
@@ -802,20 +797,17 @@
 
 		if((access(conf_file, F_OK | R_OK) != 0))
 		{
-			if(conf_file)
-				free(conf_file);
+			free(conf_file);
 			conf_file = get_path("channels.conf");
 			if((access(conf_file, F_OK | R_OK) != 0))
 			{
-				if(conf_file)
-					free(conf_file);
+				free(conf_file);
 				conf_file = strdup(MPLAYER_CONFDIR "/channels.conf");
 			}
 		}
 
 		list = dvb_get_channels(conf_file, type);
-		if(conf_file)
-			free(conf_file);
+		free(conf_file);
 		if(list == NULL)
 			continue;