diff options
author | Pavan Sondur <pavan@gluster.com> | 2009-10-07 13:12:36 +0000 |
---|---|---|
committer | Anand V. Avati <avati@dev.gluster.com> | 2009-10-07 21:40:11 -0700 |
commit | 1534a696daf25ddea67bd2bc8e2ba1993eb366c6 (patch) | |
tree | 00e00178e12c1b968d9a56d78c5d86eb28cdd2d1 /xlators | |
parent | ef488e7cceea97c4e2750b463000a2b77fc82323 (diff) |
Initialize local before any call to STACK_WIND to prevent a crash
Signed-off-by: Anand V. Avati <avati@dev.gluster.com>
BUG: 304 (Write behind crashes when a chmod is issued)
URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=304
Diffstat (limited to 'xlators')
-rw-r--r-- | xlators/performance/write-behind/src/write-behind.c | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/xlators/performance/write-behind/src/write-behind.c b/xlators/performance/write-behind/src/write-behind.c index 0d449b4ac1e..47ed2ecf4aa 100644 --- a/xlators/performance/write-behind/src/write-behind.c +++ b/xlators/performance/write-behind/src/write-behind.c @@ -1124,6 +1124,16 @@ wb_setattr (call_frame_t *frame, xlator_t *this, loc_t *loc, wb_request_t *request = NULL; int32_t ret = -1, op_errno = EINVAL; + local = CALLOC (1, sizeof (*local)); + if (local == NULL) { + op_errno = ENOMEM; + goto unwind; + } + + local->file = file; + + frame->local = local; + if (!(valid & (GF_SET_ATTR_ATIME | GF_SET_ATTR_MTIME))) { STACK_WIND (frame, wb_setattr_cbk, @@ -1149,15 +1159,6 @@ wb_setattr (call_frame_t *frame, xlator_t *this, loc_t *loc, } - local = CALLOC (1, sizeof (*local)); - if (local == NULL) { - op_errno = ENOMEM; - goto unwind; - } - - local->file = file; - - frame->local = local; if (file) { stub = fop_setattr_stub (frame, wb_setattr_helper, loc, stbuf, valid); |