From 246abbe2f95d2492a8b57c8210fbdc3511d7a4f4 Mon Sep 17 00:00:00 2001 From: Raghavendra G Date: Wed, 26 Aug 2009 05:07:34 +0000 Subject: libglusterfsclient: don't use pointer returned from basename to free allocated memory. Signed-off-by: Anand V. Avati BUG: 228 (Segmentation fault in glusterfs_getxattr) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=228 --- libglusterfsclient/src/libglusterfsclient.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'libglusterfsclient/src/libglusterfsclient.c') diff --git a/libglusterfsclient/src/libglusterfsclient.c b/libglusterfsclient/src/libglusterfsclient.c index 1ce94b8fd..d2f9a3dc2 100755 --- a/libglusterfsclient/src/libglusterfsclient.c +++ b/libglusterfsclient/src/libglusterfsclient.c @@ -2275,7 +2275,7 @@ __glusterfs_glh_getxattr (glusterfs_handle_t handle, const char *path, libglusterfs_client_ctx_t *ctx = handle; char *file = NULL; dict_t *xattr_req = NULL; - char *pathres = NULL; + char *pathres = NULL, *tmp = NULL ; GF_VALIDATE_OR_GOTO (LIBGF_XL_NAME, ctx, out); GF_VALIDATE_ABSOLUTE_PATH_OR_GOTO (LIBGF_XL_NAME, path, out); @@ -2308,8 +2308,8 @@ __glusterfs_glh_getxattr (glusterfs_handle_t handle, const char *path, goto out; } - file = strdup (pathres); - file = basename (file); + tmp = strdup (pathres); + file = basename (tmp); op_ret = libgf_client_loc_fill (&loc, ctx, 0, loc.parent->ino, file); if (op_ret == -1) { gf_log ("libglusterfsclient", @@ -2359,8 +2359,8 @@ do_getx: } out: - if (file) { - FREE (file); + if (tmp) { + FREE (tmp); } if (xattr_req) { -- cgit