summaryrefslogtreecommitdiffstats
path: root/libglusterfs/src/gf-dirent.c
diff options
context:
space:
mode:
Diffstat (limited to 'libglusterfs/src/gf-dirent.c')
-rw-r--r--libglusterfs/src/gf-dirent.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/libglusterfs/src/gf-dirent.c b/libglusterfs/src/gf-dirent.c
index 2023c19836f..b321dfc10e0 100644
--- a/libglusterfs/src/gf-dirent.c
+++ b/libglusterfs/src/gf-dirent.c
@@ -76,6 +76,12 @@ gf_dirent_free (gf_dirent_t *entries)
gf_dirent_t *entry = NULL;
gf_dirent_t *tmp = NULL;
+ if (!entries)
+ return;
+
+ if (list_empty (&entries->list))
+ return;
+
list_for_each_entry_safe (entry, tmp, &entries->list, list) {
list_del (&entry->list);
FREE (entry);