summaryrefslogtreecommitdiff
path: root/src/lib/tests/du_buff_test.c
diff options
context:
space:
mode:
authorDimitri Staessens <dimitri.staessens@intec.ugent.be>2016-03-17 18:51:55 +0100
committerDimitri Staessens <dimitri.staessens@intec.ugent.be>2016-03-17 18:51:55 +0100
commit112007d6308478c2dead8745024332b7299dd1a3 (patch)
treefd5f38f7488bab87232693ddcb7ce7723e72e2c0 /src/lib/tests/du_buff_test.c
parentd2bffe6cc47af18099d33b82920df0bb027da207 (diff)
downloadouroboros-112007d6308478c2dead8745024332b7299dd1a3.tar.gz
ouroboros-112007d6308478c2dead8745024332b7299dd1a3.zip
lib: fixes to du_buff
fixes memleaks in du_buff and du_buff_test fixes bug in copy operation
Diffstat (limited to 'src/lib/tests/du_buff_test.c')
-rw-r--r--src/lib/tests/du_buff_test.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/lib/tests/du_buff_test.c b/src/lib/tests/du_buff_test.c
index 2b7b5e55..bda1ca43 100644
--- a/src/lib/tests/du_buff_test.c
+++ b/src/lib/tests/du_buff_test.c
@@ -48,15 +48,20 @@ int du_buff_test(int argc, char ** argv)
if (dub == NULL)
return -1;
- if (k > DU_BLOCK_DATA_SIZE)
+ if (k > DU_BLOCK_DATA_SIZE) {
+ du_buff_destroy (dub);
continue;
+ }
- if (i - (j + k) > DU_BLOCK_DATA_SIZE)
+ if (i - (j + k) > DU_BLOCK_DATA_SIZE) {
+ du_buff_destroy (dub);
continue;
+ }
- if (du_buff_init(dub, k, bits, j) < 0)
+ if (du_buff_init(dub, k, bits, j) < 0) {
+ du_buff_destroy (dub);
return -1;
-
+ }
du_buff_destroy (dub);
}
}