diff options
author | Krutika Dhananjay <kdhananj@redhat.com> | 2015-06-01 11:55:29 +0530 |
---|---|---|
committer | Pranith Kumar Karampuri <pkarampu@redhat.com> | 2015-06-02 20:46:07 -0700 |
commit | e1d9895ba6f7763ba4602094f6516a6ab4a054d4 (patch) | |
tree | c258d09a84fb7baf8c2ba9f3121d047a6dafc783 /libglusterfs/src/syncop.c | |
parent | 9a314fa22667bf5afe56e63e73f4b0f50cd291f6 (diff) |
libglusterfs: Copy d_len and dict as well into dst dirent
Also, added memory allocation failure checks in light of the
comments received @
http://review.gluster.org/#/c/10809/2/libglusterfs/src/gf-dirent.c, and
http://review.gluster.org/#/c/10809/1/xlators/features/shard/src/shard.c
Change-Id: Ie4092218545c8f4f8a0e6cc1fec6ba37bbbf2620
BUG: 1226551
Signed-off-by: Krutika Dhananjay <kdhananj@redhat.com>
Reviewed-on: http://review.gluster.org/11026
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Tested-by: NetBSD Build System <jenkins@build.gluster.org>
Reviewed-by: Pranith Kumar Karampuri <pkarampu@redhat.com>
Diffstat (limited to 'libglusterfs/src/syncop.c')
-rw-r--r-- | libglusterfs/src/syncop.c | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/libglusterfs/src/syncop.c b/libglusterfs/src/syncop.c index a4e39702b70..efcf2fcfb52 100644 --- a/libglusterfs/src/syncop.c +++ b/libglusterfs/src/syncop.c @@ -1239,6 +1239,12 @@ syncop_readdirp_cbk (call_frame_t *frame, if (op_ret >= 0) { list_for_each_entry (entry, &entries->list, list) { tmp = entry_copy (entry); + if (!tmp) { + args->op_ret = -1; + args->op_errno = ENOMEM; + gf_dirent_free (&(args->entries)); + break; + } gf_log (this->name, GF_LOG_TRACE, "adding entry=%s, count=%d", tmp->d_name, count); @@ -1269,7 +1275,8 @@ syncop_readdirp (xlator_t *subvol, if (entries) list_splice_init (&args.entries.list, &entries->list); - /* TODO: need to free all the 'args.entries' in 'else' case */ + else + gf_dirent_free (&args.entries); if (xdata_out) *xdata_out = args.xdata; @@ -1308,6 +1315,12 @@ syncop_readdir_cbk (call_frame_t *frame, if (op_ret >= 0) { list_for_each_entry (entry, &entries->list, list) { tmp = entry_copy (entry); + if (!tmp) { + args->op_ret = -1; + args->op_errno = ENOMEM; + gf_dirent_free (&(args->entries)); + break; + } gf_log (this->name, GF_LOG_TRACE, "adding entry=%s, count=%d", tmp->d_name, count); @@ -1338,7 +1351,8 @@ syncop_readdir (xlator_t *subvol, if (entries) list_splice_init (&args.entries.list, &entries->list); - /* TODO: need to free all the 'args.entries' in 'else' case */ + else + gf_dirent_free (&args.entries); if (xdata_out) *xdata_out = args.xdata; |