1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-11 05:18:09 +03:00

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>
This commit is contained in:
Noel Power 2019-06-18 10:04:54 +00:00 committed by Noel Power
parent 848290d37f
commit 9e78f7b53d

View File

@ -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]);
}
}