diff sub/subreader.c @ 36629:a94f5085f3a2

sub_fribidi: Make code more robust in error case. Set freed pointers to NULL and number of lines to 0.
author reimar
date Sat, 25 Jan 2014 16:54:54 +0000
parents 5c8339df2496
children 70f30c9c35c1
line wrap: on
line diff
--- a/sub/subreader.c	Sat Jan 25 16:54:53 2014 +0000
+++ b/sub/subreader.c	Sat Jan 25 16:54:54 2014 +0000
@@ -1297,8 +1297,11 @@
     }
   }
   if (!from && l){
-    for (l = sub->lines; l;)
-      free (sub->text[--l]);
+    for (l = sub->lines; l; --l) {
+      free (sub->text[l]);
+      sub->text[l] = NULL;
+    }
+    sub->lines = 0;
     return ERR;
   }
   return sub;