[LTP] [PATCH 1/2] kernel/io/disktest: cleanup upon failure occurs

Wei Jiangang weijg.fnst@cn.fujitsu.com
Tue Nov 24 07:08:49 CET 2015


Signed-off-by: Wei Jiangang <weijg.fnst@cn.fujitsu.com>
---
 testcases/kernel/io/disktest/dump.c | 2 ++
 testcases/kernel/io/disktest/main.c | 1 +
 2 files changed, 3 insertions(+)

diff --git a/testcases/kernel/io/disktest/dump.c b/testcases/kernel/io/disktest/dump.c
index 615e8b4..d83e571 100644
--- a/testcases/kernel/io/disktest/dump.c
+++ b/testcases/kernel/io/disktest/dump.c
@@ -192,12 +192,14 @@ int do_dump(child_args_t * args)
 		pMsg(ERR, args, "could not open %s.\n", args->device);
 		pMsg(ERR, args, "%s: Error = %u\n", args->device,
 		     GETLASTERROR());
+                FREE(buff);
 		return (-1);
 	}
 
 	TargetLBA = Seek(fd, args->start_lba * BLK_SIZE);
 	if (TargetLBA != (args->start_lba * (OFF_T) BLK_SIZE)) {
 		pMsg(ERR, args, "Could not seek to start position.\n");
+                FREE(buf);
 		CLOSE(fd);
 		return (-1);
 	}
diff --git a/testcases/kernel/io/disktest/main.c b/testcases/kernel/io/disktest/main.c
index 9484ec1..050ddea 100644
--- a/testcases/kernel/io/disktest/main.c
+++ b/testcases/kernel/io/disktest/main.c
@@ -501,6 +501,7 @@ test_ll_t *run()
 			     &cleanArgs,
 			     "%s is not a regular file, could not be opened for reading, or was not found.",
 			     filespec);
+                        FREE(aFilespec);
 
 			return newTest;
 		}
-- 
1.9.3


-- 
This message has been scanned for viruses and
dangerous content by FCNIC, and is
believed to be clean.



More information about the Ltp mailing list