changeset 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 20cf5874f85a
children 70f30c9c35c1
files sub/subreader.c
diffstat 1 files changed, 5 insertions(+), 2 deletions(-) [+]
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;