diff options
author | Noel Power <noel.power@suse.com> | 2019-06-17 16:54:32 +0100 |
---|---|---|
committer | Noel Power <npower@samba.org> | 2019-07-01 13:34:10 +0000 |
commit | 848290d37fdb381b43db12675e771b462eefe7ef (patch) | |
tree | e8cc2e05dde207f490bb559e7d2bd8415701bd56 /lib/tdb | |
parent | dcaaf9ff7a281910ba12e7e9f701641f6eb97262 (diff) | |
download | samba-848290d37fdb381b43db12675e771b462eefe7ef.tar.gz |
lib/tdb/common: Fix warning: Null pointer passed as argument to param
Fixes:
lib/tdb/common/rescue.c:299:2: warning: Null pointer passed as an argument to a 'nonnull' parameter <--[clang]
qsort(found.arr, found.num, sizeof(found.arr[0]), cmp_key);
^ ~~~~~~~~~
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/rescue.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/tdb/common/rescue.c b/lib/tdb/common/rescue.c index 17e7ed85453..7e6580957bb 100644 --- a/lib/tdb/common/rescue.c +++ b/lib/tdb/common/rescue.c @@ -296,9 +296,11 @@ _PUBLIC_ int tdb_rescue(struct tdb_context *tdb, } /* Now sort by key! */ - qsort(found.arr, found.num, sizeof(found.arr[0]), cmp_key); + if (found.arr != NULL) { + qsort(found.arr, found.num, sizeof(found.arr[0]), cmp_key); + } - for (i = 0; i < found.num; ) { + for (i = 0; found.arr && i < found.num; ) { unsigned int num, num_in_hash = 0; /* How many are identical? */ |