summaryrefslogtreecommitdiff
path: root/lib/tdb
diff options
context:
space:
mode:
authorNoel Power <noel.power@suse.com>2019-06-18 10:04:54 +0000
committerNoel Power <npower@samba.org>2019-07-01 13:34:10 +0000
commit9e78f7b53d94816446e33f3d53a4d240807552ec (patch)
tree594b7ab409bfa30df8014ce408e998db287f7d7c /lib/tdb
parent848290d37fdb381b43db12675e771b462eefe7ef (diff)
downloadsamba-9e78f7b53d94816446e33f3d53a4d240807552ec.tar.gz
lib/tdb/common: Fix Array access results in a null pointer dereference
Fixes; lib/tdb/common/transaction.c:613:7: warning: Array access (via field 'blocks') results in a null pointer dereference <--[clang] if (tdb->transaction->blocks[i] != NULL) { ^ 1 warning generated. Signed-off-by: Noel Power <noel.power@suse.com> Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
Diffstat (limited to 'lib/tdb')
-rw-r--r--lib/tdb/common/transaction.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/tdb/common/transaction.c b/lib/tdb/common/transaction.c
index 290451b3285..06710896b6b 100644
--- a/lib/tdb/common/transaction.c
+++ b/lib/tdb/common/transaction.c
@@ -610,7 +610,8 @@ static int _tdb_transaction_cancel(struct tdb_context *tdb)
/* free all the transaction blocks */
for (i=0;i<tdb->transaction->num_blocks;i++) {
- if (tdb->transaction->blocks[i] != NULL) {
+ if (tdb->transaction->blocks &&
+ tdb->transaction->blocks[i] != NULL) {
free(tdb->transaction->blocks[i]);
}
}