Bug 8490 - modules/vfs_default.c:vfswrap_is_offline uses talloc_tos but does not free
Summary: modules/vfs_default.c:vfswrap_is_offline uses talloc_tos but does not free
Alias: None
Product: Samba 3.6
Classification: Unclassified
Component: VFS Modules (show other bugs)
Version: unspecified
Hardware: All All
: P5 normal
Target Milestone: ---
Assignee: Samba Bugzilla Account
QA Contact: Samba QA Contact
Depends on:
Reported: 2011-09-27 01:38 UTC by Richard Sharpe
Modified: 2011-09-27 17:21 UTC (History)
0 users

See Also:

The patch in git --format-patch format (1.08 KB, patch)
2011-09-27 05:28 UTC, Richard Sharpe
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Richard Sharpe 2011-09-27 01:38:38 UTC
In the function source3/modules/vfs_default.c:vfswrap_is_offline we
see the following:

       status = get_full_smb_filename(talloc_tos(), fname, &path);
       if (!NT_STATUS_IS_OK(status)) {
               errno = map_errno_from_nt_status(status);
               return false;

       return (dmapi_file_flags(path) & FILE_ATTRIBUTE_OFFLINE) != 0;

Should the path that was allocated above be freed? Sure, it will get
cleaned up, but perhaps it should be explicitly freed.

I will prepare a patch against master.
Comment 1 Richard Sharpe 2011-09-27 04:44:32 UTC
This is the patch:

diff --git a/source3/modules/vfs_default.c b/source3/modules/vfs_default.c
index 2dc7ec7..745b36c 100644
--- a/source3/modules/vfs_default.c
+++ b/source3/modules/vfs_default.c
@@ -1621,6 +1621,7 @@ static bool vfswrap_is_offline(struct vfs_handle_struct *h
        NTSTATUS status;
        char *path;
+       bool offline = false;
         if (ISDOT(fname->base_name) || ISDOTDOT(fname->base_name)) {
                return false;
@@ -1639,7 +1640,11 @@ static bool vfswrap_is_offline(struct vfs_handle_struct *
                 return false;
-       return (dmapi_file_flags(path) & FILE_ATTRIBUTE_OFFLINE) != 0;
+       offline = dmapi_file_flags(path) & FILE_ATTRIBUTE_OFFLINE != 0;
+       TALLOC_FREE(path);
+       return offline;
 static int vfswrap_set_offline(struct vfs_handle_struct *handle,
Comment 2 Volker Lendecke 2011-09-27 05:24:14 UTC
Hi, Richard!

Would it be possible that you do this as a git-format patch formatted attachment?


Comment 3 Richard Sharpe 2011-09-27 05:28:43 UTC
Created attachment 6951 [details]
The patch in git --format-patch format

No sooner said than done.
Comment 4 Volker Lendecke 2011-09-27 17:21:46 UTC
Pushed to master as dab8472731e9c1328eab2ff90f2ab8846b02cd46. Please re-open if you see a pressing need to get this into any release.