summaryrefslogtreecommitdiffstats
path: root/libglusterfs/src/syncop.c
diff options
context:
space:
mode:
authorKrutika Dhananjay <kdhananj@redhat.com>2015-06-01 11:55:29 +0530
committerPranith Kumar Karampuri <pkarampu@redhat.com>2015-06-03 18:58:20 -0700
commit140b4fdefa21c00af3e6015fed86c632683ab01f (patch)
tree793d9a6d0b3739f8d62f16b717c1a6e2e0b0457e /libglusterfs/src/syncop.c
parent731209a47e5ac5f2f0e3e840dfbef463dde0c014 (diff)
libglusterfs: Copy d_len and dict as well into dst dirent
Backport of: http://review.gluster.org/11026 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: Iad4736bba69e6977390f76d0c9eb64217a005b80 BUG: 1227576 Signed-off-by: Krutika Dhananjay <kdhananj@redhat.com> Reviewed-on: http://review.gluster.org/11052 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.c18
1 files changed, 16 insertions, 2 deletions
diff --git a/libglusterfs/src/syncop.c b/libglusterfs/src/syncop.c
index 48daa3226d5..3df1bef1610 100644
--- a/libglusterfs/src/syncop.c
+++ b/libglusterfs/src/syncop.c
@@ -1244,6 +1244,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);
@@ -1274,7 +1280,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;
@@ -1313,6 +1320,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);
@@ -1343,7 +1356,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;