Browse Source

av_tempfile: fix alloc type for !HAVE_MKSTEMP

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
tags/n0.9
Michael Niedermayer 13 years ago
parent
commit
c9833fc33a
1 changed files with 4 additions and 1 deletions
  1. +4
    -1
      libavutil/file.c

+ 4
- 1
libavutil/file.c 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 av_tempfile(const char *prefix, char **filename) {
int fd=-1; int fd=-1;
#if !HAVE_MKSTEMP #if !HAVE_MKSTEMP
*filename = tempnam(".", prefix);
void *ptr= tempnam(".", prefix);
*filename = av_strdup(ptr);
#undef free
free(ptr);
#else #else
size_t len = strlen(prefix) + 12; /* room for "/tmp/" and "XXXXXX\0" */ size_t len = strlen(prefix) + 12; /* room for "/tmp/" and "XXXXXX\0" */
*filename = av_malloc(len); *filename = av_malloc(len);


Loading…
Cancel
Save