From a35ee6aebc35953ed7e0843a9489aab349d06008 Mon Sep 17 00:00:00 2001 From: Andrew Borodin Date: Tue, 23 Apr 2013 11:45:09 +0400 Subject: [PATCH] (smbfs_fake_share_stat): don't access to free'd memory. Signed-off-by: Andrew Borodin --- src/vfs/smbfs/smbfs.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/vfs/smbfs/smbfs.c b/src/vfs/smbfs/smbfs.c index c3adf17f8..a7b968916 100644 --- a/src/vfs/smbfs/smbfs.c +++ b/src/vfs/smbfs/smbfs.c @@ -1475,20 +1475,22 @@ smbfs_fake_share_stat (const char *server_url, const char *path, struct stat *bu /* Make sure there is such share at server */ smbfs_connection *sc; char *p; - vfs_path_t *vpath = vfs_path_from_str (path); + vfs_path_t *vpath; + vpath = vfs_path_from_str (path); p = smbfs_get_path (&sc, vpath); vfs_path_free (vpath); - g_free (p); - if (p) + if (p != NULL) { memset (buf, 0, sizeof (*buf)); /* show this as dir */ buf->st_mode = (S_IFDIR | S_IRUSR | S_IRGRP | S_IROTH | S_IXUSR | S_IXGRP | S_IXOTH) & myumask; + g_free (p); return 0; } + g_free (p); return -1; }