Free read_write_buf and task after each test. Free iscsi2 after
each PGR test when using CUnit version 2. Note: CUnit version 1
doesn't support test setup and teardown functions.
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
If scsi_cdb_persistent_reserve_out() succeeds a call to
scsi_free_scsi_task() won't free any memory allocated with scsi_malloc()
in this function because the memset() call in this function overwrites
the task->mem pointer. Move the memset() call up such that it doesn't
clear task->mem. This makes it possible for the caller of this function
to free the memory allocated by this function by calling
scsi_free_scsi_task(). Merge the error handling code such that the code
for freeing memory only occurs once.
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Several cleanup paths can be simplified if it is allowed to pass a
NULL pointer to scsi_free_scsi_task(). Hence modify this function
such that it returns immediately if passed a NULL task pointer.
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
- Add manpages for iscsi-ls/iscsi-inq and iscsi-swp
- Many new tests and updates to the testsuite.
- Fix memory leak in iscsi_reconnect
- Fixes to the persistent reservation tests
- AROS support
- Fix/restore windows support
- Switch to libgcrypt for the MD5 support.
- Fix buffer overflow in the persistent reserver unmarshalling code.
- And many more minor fixes.
This patch fixes the following Valgrind complaint:
Invalid read of size 4
at 0x524A858: iscsi_reconnect (connect.c:378)
by 0x5258794: iscsi_service (socket.c:707)
by 0x52599C4: event_loop (sync.c:67)
by 0x525AFD7: iscsi_reserve6_sync (sync.c:1096)
by 0x40A40A: reserve6 (iscsi-support.c:3291)
by 0x422C95: test_reserve6_target_warm_reset (test_reserve6_target_warm_reset.c:39)
by 0x503B05F: ??? (in /usr/lib/libcunit.so.1.0.1)
by 0x503B375: ??? (in /usr/lib/libcunit.so.1.0.1)
by 0x503B69F: CU_run_all_tests (in /usr/lib/libcunit.so.1.0.1)
by 0x403171: main (iscsi-test-cu.c:1258)
Address 0x6443958 is 3,032 bytes inside a block of size 4,120 free'd
at 0x4C2B83A: free (vg_replace_malloc.c:468)
by 0x524A846: iscsi_reconnect (connect.c:374)
by 0x5258794: iscsi_service (socket.c:707)
by 0x52599C4: event_loop (sync.c:67)
by 0x525AFD7: iscsi_reserve6_sync (sync.c:1096)
by 0x40A40A: reserve6 (iscsi-support.c:3291)
by 0x422C95: test_reserve6_target_warm_reset (test_reserve6_target_warm_reset.c:39)
by 0x503B05F: ??? (in /usr/lib/libcunit.so.1.0.1)
by 0x503B375: ??? (in /usr/lib/libcunit.so.1.0.1)
by 0x503B69F: CU_run_all_tests (in /usr/lib/libcunit.so.1.0.1)
by 0x403171: main (iscsi-test-cu.c:1258)
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Linux distributions like openSUSE 12.3 include CUnit version 2.
Apparently libiscsi uses some CUnit version 1 data structures that
have been modified in CUnit version 2. This causes the libiscsi
build to fail against CUnit version 2. Fix this by detecting the
CUnit version during the configure step.
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
clang defaults to c99 so remove inline statements
(http://clang.llvm.org/compatibility.html#inline ) on functions shared
across different translation units.
clang's linker doesn't like major numbers over 255 so change how SOREL
is generated in Makefile.am.