summaryrefslogtreecommitdiffstats
path: root/libglusterfs/src/call-stub.c
diff options
context:
space:
mode:
Diffstat (limited to 'libglusterfs/src/call-stub.c')
-rw-r--r--libglusterfs/src/call-stub.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/libglusterfs/src/call-stub.c b/libglusterfs/src/call-stub.c
index d58a2c7f963..0fd0b3d5a47 100644
--- a/libglusterfs/src/call-stub.c
+++ b/libglusterfs/src/call-stub.c
@@ -1992,6 +1992,12 @@ fop_readdir_cbk_stub (call_frame_t *frame,
stub->args.readdir_cbk.op_errno = op_errno;
INIT_LIST_HEAD (&stub->args.readdir_cbk.entries.list);
+ /* This check must come after the init of head above
+ * so we're sure the list is empty for list_empty.
+ */
+ if (!entries)
+ goto out;
+
if (op_ret > 0) {
list_for_each_entry (entry, &entries->list, list) {
stub_entry = gf_dirent_for_name (entry->d_name);