summaryrefslogtreecommitdiff
path: root/libavutil/buffer_internal.h
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2014-11-27 23:03:07 +0100
committerMichael Niedermayer <michaelni@gmx.at>2014-11-27 23:42:16 +0100
commit6db8cd8f37b72c5397541a9689a5378bf1a559ce (patch)
tree0ad287284bd10b805af5fbd6afa4afe8422c7921 /libavutil/buffer_internal.h
parentf00e9c4b10f5ab7cd382d3019eb7bee13fcc3866 (diff)
parentfbd6c97f9ca858140df16dd07200ea0d4bdc1a83 (diff)
downloadffmpeg-6db8cd8f37b72c5397541a9689a5378bf1a559ce.tar.gz
Merge commit 'fbd6c97f9ca858140df16dd07200ea0d4bdc1a83'
* commit 'fbd6c97f9ca858140df16dd07200ea0d4bdc1a83': lavu: fix memory leaks by using a mutex instead of atomics Conflicts: libavutil/buffer.c The atomics code is left in place as a fallback for synchronization in the absence of p/w32 threads. Our ABI did not requires applications to only use threads (and matching ones) to what libavutil was build with Our code also was not affected by the leak this change fixes, though no question the atomics based implementation is not pretty at all. First and foremost the code must work, being pretty comes after that. If this causes problems, for example when libavutil is used by multiple applications each using a different kind of threading system then the default possibly has to be changed to the uglier atomics. See: cea3a63ba3d89d8403eef008f7a7c54d645cff70 Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavutil/buffer_internal.h')
-rw-r--r--libavutil/buffer_internal.h6
1 files changed, 4 insertions, 2 deletions
diff --git a/libavutil/buffer_internal.h b/libavutil/buffer_internal.h
index c29190839e..e6530485d3 100644
--- a/libavutil/buffer_internal.h
+++ b/libavutil/buffer_internal.h
@@ -22,6 +22,7 @@
#include <stdint.h>
#include "buffer.h"
+#include "thread.h"
/**
* The buffer is always treated as read-only.
@@ -68,11 +69,12 @@ typedef struct BufferPoolEntry {
void (*free)(void *opaque, uint8_t *data);
AVBufferPool *pool;
- struct BufferPoolEntry * volatile next;
+ struct BufferPoolEntry *next;
} BufferPoolEntry;
struct AVBufferPool {
- BufferPoolEntry * volatile pool;
+ AVMutex mutex;
+ BufferPoolEntry *pool;
/*
* This is used to track when the pool is to be freed.