diff subreader.c @ 15603:2d1ad16b6021

strdup subtitle filename at a more appropriate place, fixing memleaks and double frees.
author reimar
date Wed, 01 Jun 2005 09:01:41 +0000
parents 834bdc663f3f
children 0ca3fb62d2da
line wrap: on
line diff
--- a/subreader.c	Tue May 31 22:35:40 2005 +0000
+++ b/subreader.c	Wed Jun 01 09:01:41 2005 +0000
@@ -1350,7 +1350,6 @@
 #endif
 
 sub_data* sub_read_file (char *filename, float fps) {
-        //filename is assumed to be malloc'ed,  free() is used in sub_free()
     FILE *fd;
     int n_max, n_first, i, j, sub_first, sub_orig;
     subtitle *first, *second, *sub, *return_sub;
@@ -1718,7 +1717,7 @@
 }
     if (return_sub == NULL) return NULL;
     subt_data = (sub_data *)malloc(sizeof(sub_data));
-    subt_data->filename = filename;
+    subt_data->filename = strdup(filename);
     subt_data->sub_uses_time = uses_time;
     subt_data->sub_num = sub_num;
     subt_data->sub_errs = sub_errs;