changeset 25314:02e2e7a5599a

Fix memory leak that tmp allocated but maybe not used.
author ulion
date Mon, 10 Dec 2007 14:43:09 +0000
parents 9e13376e0daa
children dfa8a510c81c
files libmpdemux/demuxer.c
diffstat 1 files changed, 6 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/libmpdemux/demuxer.c	Mon Dec 10 14:39:19 2007 +0000
+++ b/libmpdemux/demuxer.c	Mon Dec 10 14:43:09 2007 +0000
@@ -1170,11 +1170,13 @@
         }
 
         if(chapter_name) {
-            char *tmp = malloc(16);
             *chapter_name = NULL;
-            if(num_chapters  && *num_chapters && tmp) {
-                sprintf(tmp, " of %3d", *num_chapters);
-                *chapter_name = tmp;
+            if (num_chapters && *num_chapters) {
+                char *tmp = malloc(16);
+                if (tmp) {
+                    sprintf(tmp, " of %3d", *num_chapters);
+                    *chapter_name = tmp;
+                }
             }
         }