diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2013-08-01 11:06:38 +0200 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2013-08-01 11:29:03 +0200 |
commit | 161054f37b15893a5854874eed87bb4a4561d04a (patch) | |
tree | a66d7be22e87ebdcd5f4da093c7ee8f1998e48a9 /libavutil/tree.c | |
parent | bc47d126bf41b0ea0981a0f44336e2c782899db3 (diff) | |
parent | c2e936de07d054bf476e60445b453bf6b4836820 (diff) | |
download | ffmpeg-161054f37b15893a5854874eed87bb4a4561d04a.tar.gz |
Merge commit 'c2e936de07d054bf476e60445b453bf6b4836820'
* commit 'c2e936de07d054bf476e60445b453bf6b4836820':
tree-test: Refactor and plug memory leaks
Conflicts:
libavutil/tree.c
Most of this commit is not merged due to bugs in it
Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavutil/tree.c')
-rw-r--r-- | libavutil/tree.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/libavutil/tree.c b/libavutil/tree.c index cdf9bff604..643d0a9a7d 100644 --- a/libavutil/tree.c +++ b/libavutil/tree.c @@ -18,6 +18,7 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ +#include "error.h" #include "log.h" #include "mem.h" #include "tree.h" @@ -220,6 +221,7 @@ int main(int argc, char **argv) for (i = 0; i < 10000; i++) { intptr_t j = av_lfg_get(&prng) % 86294; + if (check(root) > 999) { av_log(NULL, AV_LOG_ERROR, "FATAL error %d\n", i); print(root, 0); @@ -229,6 +231,10 @@ int main(int argc, char **argv) if (!node) node = av_tree_node_alloc(); + if (!node) { + av_log(NULL, AV_LOG_ERROR, "Memory allocation failure.\n"); + return AVERROR(ENOMEM); + } av_tree_insert(&root, (void *)(j + 1), cmp, &node); j = av_lfg_get(&prng) % 86294; @@ -241,6 +247,9 @@ int main(int argc, char **argv) av_log(NULL, AV_LOG_ERROR, "removal failure %d\n", i); } } + + av_tree_destroy(root); + return 0; } #endif |