diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2014-12-26 01:13:49 +0100 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2014-12-26 01:13:49 +0100 |
commit | 954fc854f23740bf2b87240474cbc3c391449916 (patch) | |
tree | 7ccce17e9003cc2847488f17657e790e21f68aa5 | |
parent | 68609edd4acf8ea82889953659ca583f1894f441 (diff) | |
download | ffmpeg-954fc854f23740bf2b87240474cbc3c391449916.tar.gz |
avformat/cache: cleanup cache file on cache write failure
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r-- | libavformat/cache.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/libavformat/cache.c b/libavformat/cache.c index 0746e98d3e..29b4a0687f 100644 --- a/libavformat/cache.c +++ b/libavformat/cache.c @@ -92,7 +92,7 @@ static int cache_open(URLContext *h, const char *arg, int flags) static int add_entry(URLContext *h, const unsigned char *buf, int size) { Context *c= h->priv_data; - int64_t pos; + int64_t pos = -1; int ret; CacheEntry *entry = av_malloc(sizeof(*entry)); CacheEntry *entry_ret; @@ -132,6 +132,8 @@ static int add_entry(URLContext *h, const unsigned char *buf, int size) return 0; fail: + if (pos >= 0) + ftruncate(c->fd, pos); av_free(entry); av_free(node); return ret; |