summaryrefslogtreecommitdiffstats
path: root/libglusterfsclient/src/libglusterfsclient.c
diff options
context:
space:
mode:
authorRaghavendra G <raghavendra@gluster.com>2009-08-26 05:07:34 +0000
committerAnand V. Avati <avati@dev.gluster.com>2009-09-02 10:30:19 -0700
commit246abbe2f95d2492a8b57c8210fbdc3511d7a4f4 (patch)
tree16bdfba2d65b6040468ecf1411f55b4fa2c67421 /libglusterfsclient/src/libglusterfsclient.c
parent33b93a6e9ac82b92d0bca8275ed385740ceca5ec (diff)
libglusterfsclient: don't use pointer returned from basename to free 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/src/libglusterfsclient.c')
-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 1ce94b8..d2f9a3d 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) {