Fix unmatched temporary buffer allocations
[yaffs2.git] / direct / test-framework / stress_tests / threading / test_b.c
1 /*
2  * YAFFS: Yet another FFS. A NAND-flash specific file system.
3  *
4  * Copyright (C) 2002-2018 Aleph One Ltd.
5  *
6  * Created by Timothy Manning <timothy@yaffs.net>
7  *
8  * This program is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License version 2 as
10  * published by the Free Software Foundation.
11  */
12
13 #include "test_b.h"
14
15 void test_b(void *x)
16 {
17         struct bovver_context *bc = (struct bovver_context *)x;
18         int n = rand() % 20;
19         
20         bc->cycle++;
21
22         if(!bc->dirH)
23                 bc->dirH = yaffs_opendir(bc->baseDir);
24
25         if(!bc->dirH)
26                 return;
27
28         if(n == 0){
29                 yaffs_closedir(bc->dirH);
30                 bc->dirH = NULL;
31         } else {
32                 while(n > 1){
33                         n--;
34                         yaffs_readdir(bc->dirH);
35                 }
36         }
37 }
38