From: <tak...@us...> - 2013-01-29 09:40:10
|
Revision: 7685 http://gfarm.svn.sourceforge.net/gfarm/?rev=7685&view=rev Author: takuya-i Date: 2013-01-29 09:40:02 +0000 (Tue, 29 Jan 2013) Log Message: ----------- fix #593 - gfarm_samba leaks memory Modified Paths: -------------- gfarm_samba/trunk/gfarm.c Modified: gfarm_samba/trunk/gfarm.c =================================================================== --- gfarm_samba/trunk/gfarm.c 2013-01-29 09:17:39 UTC (rev 7684) +++ gfarm_samba/trunk/gfarm.c 2013-01-29 09:40:02 UTC (rev 7685) @@ -271,6 +271,7 @@ gdp->path = strdup(fname); if (gdp == NULL || gdp->path == NULL) { gflog_error(GFARM_MSG_UNFIXED, "opendir: no memory"); + free(gdp->path); free(gdp); gfs_closedir(dp); return (NULL); @@ -440,6 +441,7 @@ gflog_debug(GFARM_MSG_UNFIXED, "closedir"); e = gfs_closedir(gdp->dp); + free(gdp->path); free(gdp); if (e == GFARM_ERR_NO_ERROR) return (0); @@ -506,6 +508,7 @@ gdp->path = strdup(fname); if (gdp == NULL || gdp->path == NULL) { gflog_error(GFARM_MSG_UNFIXED, "open: no memory"); + free(gdp->path); free(gdp); gfs_closedir(dp); errno = ENOMEM; @@ -549,9 +552,12 @@ msg = "gfs_pio_close"; e = gfs_pio_close((GFS_File)fsp->fh->gen_id); } else { + struct gfvfs_dir *gdp = (struct gfvfs_dir *)fsp->fh->gen_id; + msg = "gfs_closedir"; - e = gfs_closedir(((struct gfvfs_dir *)fsp->fh->gen_id)->dp); - free((struct gfvfs_dir *)fsp->fh->gen_id); + e = gfs_closedir(gdp->dp); + free(gdp->path); + free(gdp); } if (e == GFARM_ERR_NO_ERROR) return (0); @@ -1348,10 +1354,8 @@ gfvfs_sys_acl_free_acl(vfs_handle_struct *handle, SMB_ACL_T posix_acl) { gflog_debug(GFARM_MSG_UNFIXED, "sys_acl_free_acl"); - gflog_error(GFARM_MSG_UNFIXED, "sys_acl_free_acl: %s", - strerror(ENOSYS)); - errno = ENOSYS; - return (-1); + SAFE_FREE(posix_acl); + return (0); } static int This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |