[MPlayer-cvslog] r37678 - trunk/stream/stream_dvb.c

reimar subversion at mplayerhq.hu
Thu Feb 11 22:38:00 CET 2016


Author: reimar
Date: Thu Feb 11 22:37:59 2016
New Revision: 37678

Log:
stream_dvb.c: Fix memleak.

Also move variable into proper scope.
That also helps making the Coverity results
more understandable.
Fixes a Coverity issue.

Modified:
   trunk/stream/stream_dvb.c

Modified: trunk/stream/stream_dvb.c
==============================================================================
--- trunk/stream/stream_dvb.c	Thu Feb 11 22:12:09 2016	(r37677)
+++ trunk/stream/stream_dvb.c	Thu Feb 11 22:37:59 2016	(r37678)
@@ -767,7 +767,6 @@ dvb_config_t *dvb_get_config(void)
 {
 	int i, fd, type, size;
 	char filename[30], *conf_file, *name;
-	dvb_channels_list *list;
 	dvb_config_t *conf = NULL;
 
 
@@ -780,6 +779,7 @@ dvb_config_t *dvb_get_config(void)
 	conf->cards = NULL;
 	for(i=0; i<MAX_CARDS; i++)
 	{
+		dvb_channels_list *list;
 		dvb_card_config_t *tmp;
 		snprintf(filename, sizeof(filename), "/dev/dvb/adapter%d/frontend0", i);
 		fd = open(filename, O_RDONLY|O_NONBLOCK);
@@ -838,6 +838,8 @@ dvb_config_t *dvb_get_config(void)
 		if(tmp == NULL)
 		{
 			fprintf(stderr, "DVB_CONFIG, can't realloc %d bytes, skipping\n", size);
+			free(list->channels);
+			free(list);
 			continue;
 		}
 		conf->cards = tmp;
@@ -846,6 +848,8 @@ dvb_config_t *dvb_get_config(void)
 		if(name==NULL)
 		{
 			fprintf(stderr, "DVB_CONFIG, can't realloc 20 bytes, skipping\n");
+			free(list->channels);
+			free(list);
 			continue;
 		}
 


More information about the MPlayer-cvslog mailing list