diff options
author | Pranith Kumar K <pranithk@gluster.com> | 2010-08-05 21:40:55 +0000 |
---|---|---|
committer | Anand V. Avati <avati@dev.gluster.com> | 2010-08-06 03:37:48 -0700 |
commit | 9dca1bc7822a71fbefb4ca161281884cdf31129b (patch) | |
tree | dc3a6ead3e24f015dfbcad07e0bf9b3351da1fed | |
parent | d5dd69dc2045fefb3f407689535a09a115206e4c (diff) |
protocol/client: fix for client mem-leaks in case of failures
Signed-off-by: Pranith Kumar K <pranithk@gluster.com>
Signed-off-by: Anand V. Avati <avati@dev.gluster.com>
BUG: 994 (memory leak in client protocol)
URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=994
-rw-r--r-- | xlators/protocol/client/src/client-protocol.c | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/xlators/protocol/client/src/client-protocol.c b/xlators/protocol/client/src/client-protocol.c index 485eaa122..5a2ea4cb1 100644 --- a/xlators/protocol/client/src/client-protocol.c +++ b/xlators/protocol/client/src/client-protocol.c @@ -737,7 +737,10 @@ client_create (call_frame_t *frame, xlator_t *this, loc_t *loc, int32_t flags, unwind: if (hdr) free (hdr); + frame->local = NULL; STACK_UNWIND (frame, -1, EINVAL, fd, NULL, NULL); + if (local) + client_local_wipe (local); return 0; } @@ -808,7 +811,10 @@ client_open (call_frame_t *frame, xlator_t *this, loc_t *loc, int32_t flags, unwind: if (hdr) free (hdr); + frame->local = NULL; STACK_UNWIND (frame, -1, EINVAL, fd); + if (local) + client_local_wipe (local); return 0; } @@ -994,7 +1000,10 @@ client_mknod (call_frame_t *frame, xlator_t *this, loc_t *loc, mode_t mode, unwind: if (hdr) free (hdr); + frame->local = NULL; STACK_UNWIND (frame, -1, EINVAL, loc->inode, NULL); + if (local) + client_local_wipe (local); return 0; } @@ -1068,7 +1077,10 @@ client_mkdir (call_frame_t *frame, xlator_t *this, loc_t *loc, mode_t mode) unwind: if (hdr) free (hdr); + frame->local = NULL; STACK_UNWIND_STRICT (mkdir, frame, -1, EINVAL, loc->inode, NULL, NULL, NULL); + if (local) + client_local_wipe (local); return 0; } @@ -1252,7 +1264,10 @@ client_symlink (call_frame_t *frame, xlator_t *this, const char *linkname, unwind: if (hdr) free (hdr); + frame->local = NULL; STACK_UNWIND (frame, -1, EINVAL, loc->inode, NULL); + if (local) + client_local_wipe (local); return 0; } @@ -1421,7 +1436,10 @@ client_link (call_frame_t *frame, xlator_t *this, loc_t *oldloc, loc_t *newloc) unwind: if (hdr) free (hdr); + frame->local = NULL; STACK_UNWIND (frame, -1, op_errno, oldloc->inode, NULL); + if (local) + client_local_wipe (local); return 0; } @@ -2404,7 +2422,10 @@ client_opendir (call_frame_t *frame, xlator_t *this, loc_t *loc, unwind: if (hdr) free (hdr); + frame->local = NULL; STACK_UNWIND (frame, -1, EINVAL, fd); + if (local) + client_local_wipe (local); return 0; } @@ -3399,7 +3420,10 @@ client_lookup (call_frame_t *frame, xlator_t *this, loc_t *loc, return ret; unwind: + frame->local = NULL; STACK_UNWIND (frame, op_ret, op_errno, loc->inode, NULL, NULL); + if (local) + client_local_wipe (local); return ret; } @@ -4213,6 +4237,7 @@ client_mknod_cbk (call_frame_t *frame, gf_hdr_common_t *hdr, size_t hdrlen, local->loc.path); STACK_UNWIND (frame, -1, EINVAL, inode, NULL, NULL, NULL); + client_local_wipe (local); return 0; } @@ -4272,6 +4297,7 @@ client_symlink_cbk (call_frame_t *frame, gf_hdr_common_t *hdr, size_t hdrlen, local->loc.path); STACK_UNWIND (frame, -1, EINVAL, inode, NULL, NULL, NULL); + client_local_wipe (local); return 0; } gf_stat_to_stat (&rsp->preparent, &preparent); @@ -4748,6 +4774,7 @@ client_mkdir_cbk (call_frame_t *frame, gf_hdr_common_t *hdr, size_t hdrlen, local->loc.path); STACK_UNWIND (frame, -1, EINVAL, inode, NULL, NULL, NULL); + client_local_wipe (local); return 0; } |