changeset 14237:cb14ee6b0944

fix memleak in idx parser. patch by elupus [elupus {at] ecce <dot) se]
author reimar
date Sat, 25 Dec 2004 12:08:33 +0000
parents 2dc4595c3998
children 5b742f820832
files vobsub.c
diffstat 1 files changed, 3 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/vobsub.c	Sat Dec 25 11:31:32 2004 +0000
+++ b/vobsub.c	Sat Dec 25 12:08:33 2004 +0000
@@ -946,13 +946,11 @@
 {
     ssize_t line_size;
     int res = -1;
-    do {
 	size_t line_reserve = 0;
 	char *line = NULL;
+    do {
 	line_size = getline(&line, &line_reserve, fd);
 	if (line_size < 0) {
-	    if (line)
-		free(line);
 	    break;
 	}
 	if (*line == 0 || *line == '\r' || *line == '\n' || *line == '#')
@@ -984,6 +982,8 @@
 	    mp_msg(MSGT_VOBSUB,MSGL_ERR,  "ERROR in %s", line);
 	break;
     } while (1);
+    if (line)
+      free(line);
     return res;
 }