av_tempfile: fix alloc type for !HAVE_MKSTEMP

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
Michael Niedermayer 2011-10-16 15:42:18 +02:00
parent 885158c887
commit c9833fc33a
1 changed files with 4 additions and 1 deletions

View File

@ -133,7 +133,10 @@ void av_file_unmap(uint8_t *bufptr, size_t size)
int av_tempfile(const char *prefix, char **filename) {
int fd=-1;
#if !HAVE_MKSTEMP
*filename = tempnam(".", prefix);
void *ptr= tempnam(".", prefix);
*filename = av_strdup(ptr);
#undef free
free(ptr);
#else
size_t len = strlen(prefix) + 12; /* room for "/tmp/" and "XXXXXX\0" */
*filename = av_malloc(len);