changeset 18472:57cac8462fa8

prevent memleak
author nicodvb
date Sat, 13 May 2006 09:08:28 +0000
parents aa9ae54516c3
children ba3244f65665
files libmpdemux/dvbin.c
diffstat 1 files changed, 4 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/libmpdemux/dvbin.c	Sat May 13 09:01:18 2006 +0000
+++ b/libmpdemux/dvbin.c	Sat May 13 09:08:28 2006 +0000
@@ -779,7 +779,7 @@
 	char filename[30], *conf_file, *name;
 	dvb_channels_list *list;
 	dvb_card_config_t *cards = NULL;
-	dvb_config_t *conf = NULL;
+	dvb_config_t *conf = NULL, *tmp;
 	
 	if(dvb_config != NULL)
 		return dvb_config;
@@ -833,13 +833,14 @@
 			continue;
 		
 		size = sizeof(dvb_card_config_t) * (conf->count + 1);
-		cards = realloc(conf->cards, size);
+		tmp = realloc(conf->cards, size);
 
-		if(cards == NULL)
+		if(tmp == NULL)
 	{
 			fprintf(stderr, "DVB_CONFIG, can't realloc %d bytes, skipping\n", size);
 			continue;
 	}
+		cards = tmp;
 
 		name = (char*) malloc(20);
 		if(name==NULL)