changeset 32782:a61e62388508

Simplify frees in load_vob_subtitle.
author cboesch
date Mon, 07 Feb 2011 19:29:36 +0000
parents 93629a05a380
children 5b3f37eab972
files sub/subreader.c
diffstat 1 files changed, 6 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/sub/subreader.c	Mon Feb 07 19:27:17 2011 +0000
+++ b/sub/subreader.c	Mon Feb 07 19:29:36 2011 +0000
@@ -2161,10 +2161,8 @@
     if (!name)
         return;
     strcpy_strip_ext(name, fname);
-    if (add_f(name, ifo, 0, spu)) {
-        free(name);
-        return;
-    }
+    if (add_f(name, ifo, 0, spu))
+        goto out;
 
     // Try looking at the dirs specified by sub-paths option
     if (sub_paths) {
@@ -2172,6 +2170,7 @@
 
         for (i = 0; sub_paths[i]; i++) {
             char *path, *psub;
+            int sub_found;
 
             path = mp_path_join(fname, sub_paths[i]);
             if (!path)
@@ -2182,11 +2181,10 @@
             if (!psub)
                 goto out;
 
-            if (add_f(psub, ifo, 0, spu)) {
-                free(psub);
+            sub_found = add_f(psub, ifo, 0, spu);
+            free(psub);
+            if (sub_found)
                 goto out;
-            }
-            free(psub);
         }
     }