Browse code

av_tempfile: fix alloc type for !HAVE_MKSTEMP

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>

Michael Niedermayer authored on 2011/10/16 22:42:18
Showing 1 changed files
... ...
@@ -133,7 +133,10 @@ void av_file_unmap(uint8_t *bufptr, size_t size)
133 133
 int av_tempfile(const char *prefix, char **filename) {
134 134
     int fd=-1;
135 135
 #if !HAVE_MKSTEMP
136
-    *filename = tempnam(".", prefix);
136
+    void *ptr= tempnam(".", prefix);
137
+    *filename = av_strdup(ptr);
138
+#undef free
139
+    free(ptr);
137 140
 #else
138 141
     size_t len = strlen(prefix) + 12; /* room for "/tmp/" and "XXXXXX\0" */
139 142
     *filename = av_malloc(len);