r14431: don't call qsort with a null array
authorAndrew Tridgell <tridge@samba.org>
Wed, 15 Mar 2006 05:50:42 +0000 (05:50 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 18:57:23 +0000 (13:57 -0500)
(This used to be commit 2c33f577ad5bf8cddec735e75a26c4a4c07d8c51)

source4/lib/ldb/ldb_tdb/ldb_index.c

index 2fc20adb3067668850be346b1ad7d24109de168e..e2a3201884e99e4262da1b0b2501451ecf13d0bb 100644 (file)
@@ -241,7 +241,9 @@ static int ltdb_index_dn_simple(struct ldb_module *module,
 
        talloc_free(msg);
 
-       qsort(list->dn, list->count, sizeof(char *), (comparison_fn_t) list_cmp);
+       if (list->count > 1) {
+               qsort(list->dn, list->count, sizeof(char *), (comparison_fn_t) list_cmp);
+       }
 
        return 1;
 }