summaryrefslogtreecommitdiff
path: root/source4
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2004-10-02 13:29:20 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 12:59:33 -0500
commit421ff99f5d33c4be72f56f09d82f6ba6fe1bea5c (patch)
tree89e7c6b36b196876e9547cdd7ec002ec32dbee3b /source4
parentd1a568363049c82f4314f7a1c5453a92bee84343 (diff)
downloadsamba-421ff99f5d33c4be72f56f09d82f6ba6fe1bea5c.tar.gz
samba-421ff99f5d33c4be72f56f09d82f6ba6fe1bea5c.tar.bz2
samba-421ff99f5d33c4be72f56f09d82f6ba6fe1bea5c.zip
r2788: prevent a memory leak in the pvfs search backend
(This used to be commit 1de22070610231e60d329f56997bbec2cc674a4e)
Diffstat (limited to 'source4')
-rw-r--r--source4/ntvfs/posix/pvfs_search.c4
-rw-r--r--source4/ntvfs/posix/pvfs_shortname.c6
2 files changed, 6 insertions, 4 deletions
diff --git a/source4/ntvfs/posix/pvfs_search.c b/source4/ntvfs/posix/pvfs_search.c
index f8d538bab2..211cb68b86 100644
--- a/source4/ntvfs/posix/pvfs_search.c
+++ b/source4/ntvfs/posix/pvfs_search.c
@@ -125,7 +125,7 @@ static NTSTATUS fill_search_info(struct pvfs_state *pvfs,
file->both_directory_info.alloc_size = name->dos.alloc_size;
file->both_directory_info.attrib = name->dos.attrib;
file->both_directory_info.ea_size = name->dos.ea_size;
- file->both_directory_info.short_name.s = pvfs_short_name(pvfs, name);
+ file->both_directory_info.short_name.s = pvfs_short_name(pvfs, file, name);
file->both_directory_info.name.s = fname;
return NT_STATUS_OK;
@@ -154,7 +154,7 @@ static NTSTATUS fill_search_info(struct pvfs_state *pvfs,
file->id_both_directory_info.attrib = name->dos.attrib;
file->id_both_directory_info.ea_size = name->dos.ea_size;
file->id_both_directory_info.file_id = name->dos.file_id;
- file->id_both_directory_info.short_name.s = pvfs_short_name(pvfs, name);
+ file->id_both_directory_info.short_name.s = pvfs_short_name(pvfs, file, name);
file->id_both_directory_info.name.s = fname;
return NT_STATUS_OK;
diff --git a/source4/ntvfs/posix/pvfs_shortname.c b/source4/ntvfs/posix/pvfs_shortname.c
index 33e601e429..21c0ca6ea0 100644
--- a/source4/ntvfs/posix/pvfs_shortname.c
+++ b/source4/ntvfs/posix/pvfs_shortname.c
@@ -38,8 +38,10 @@ char *pvfs_short_name_component(struct pvfs_state *pvfs, const char *name)
return the short name for a given entry in a directory
TODO: this is obviously not very useful in its current form !
*/
-char *pvfs_short_name(struct pvfs_state *pvfs, struct pvfs_filename *name)
+char *pvfs_short_name(struct pvfs_state *pvfs, TALLOC_CTX *mem_ctx, struct pvfs_filename *name)
{
char *p = strrchr(name->full_name, '/');
- return pvfs_short_name_component(pvfs, p+1);
+ char *ret = pvfs_short_name_component(pvfs, p+1);
+ talloc_steal(mem_ctx, ret);
+ return ret;
}