summaryrefslogtreecommitdiffstats
path: root/libglusterfsclient
diff options
context:
space:
mode:
authorRaghavendra G <raghavendra@gluster.com>2009-08-26 05:08:18 +0000
committerAnand V. Avati <avati@dev.gluster.com>2009-09-02 10:29:56 -0700
commitbc1bacb14650809f4685025c9fb4b799f9510df9 (patch)
tree88216793363dc0b07f99d53d16f77e4dac1c97da /libglusterfsclient
parent4d479650245d15e6bb5d6993919ebd3eaa68f089 (diff)
libglusterfsclient: don't use pointer returned by basename while freeing allocated memory.
Signed-off-by: Anand V. Avati <avati@dev.gluster.com> BUG: 228 (Segmentation fault in glusterfs_getxattr) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=228
Diffstat (limited to 'libglusterfsclient')
-rwxr-xr-xlibglusterfsclient/src/libglusterfsclient.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/libglusterfsclient/src/libglusterfsclient.c b/libglusterfsclient/src/libglusterfsclient.c
index 24e73a82703..d8236cf3f92 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) {