mirror of
https://github.com/xenia-project/FFmpeg.git
synced 2024-11-24 20:19:55 +00:00
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>
This commit is contained in:
commit
161054f37b
@ -18,6 +18,7 @@
|
|||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "error.h"
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
#include "mem.h"
|
#include "mem.h"
|
||||||
#include "tree.h"
|
#include "tree.h"
|
||||||
@ -220,6 +221,7 @@ int main(int argc, char **argv)
|
|||||||
|
|
||||||
for (i = 0; i < 10000; i++) {
|
for (i = 0; i < 10000; i++) {
|
||||||
intptr_t j = av_lfg_get(&prng) % 86294;
|
intptr_t j = av_lfg_get(&prng) % 86294;
|
||||||
|
|
||||||
if (check(root) > 999) {
|
if (check(root) > 999) {
|
||||||
av_log(NULL, AV_LOG_ERROR, "FATAL error %d\n", i);
|
av_log(NULL, AV_LOG_ERROR, "FATAL error %d\n", i);
|
||||||
print(root, 0);
|
print(root, 0);
|
||||||
@ -229,6 +231,10 @@ int main(int argc, char **argv)
|
|||||||
|
|
||||||
if (!node)
|
if (!node)
|
||||||
node = av_tree_node_alloc();
|
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);
|
av_tree_insert(&root, (void *)(j + 1), cmp, &node);
|
||||||
|
|
||||||
j = av_lfg_get(&prng) % 86294;
|
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_log(NULL, AV_LOG_ERROR, "removal failure %d\n", i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
av_tree_destroy(root);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user