svn commit: samba r2788 - in branches/SAMBA_4_0/source/ntvfs/posix: .

tridge at samba.org tridge at samba.org
Sat Oct 2 13:29:20 GMT 2004


Author: tridge
Date: 2004-10-02 13:29:20 +0000 (Sat, 02 Oct 2004)
New Revision: 2788

WebSVN: http://websvn.samba.org/websvn/changeset.php?rep=samba&path=/branches/SAMBA_4_0/source/ntvfs/posix&rev=2788&nolog=1

Log:
prevent a memory leak in the pvfs search backend




Modified:
   branches/SAMBA_4_0/source/ntvfs/posix/pvfs_search.c
   branches/SAMBA_4_0/source/ntvfs/posix/pvfs_shortname.c


Changeset:
Modified: branches/SAMBA_4_0/source/ntvfs/posix/pvfs_search.c
===================================================================
--- branches/SAMBA_4_0/source/ntvfs/posix/pvfs_search.c	2004-10-02 12:30:02 UTC (rev 2787)
+++ branches/SAMBA_4_0/source/ntvfs/posix/pvfs_search.c	2004-10-02 13:29:20 UTC (rev 2788)
@@ -125,7 +125,7 @@
 		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 @@
 		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;
 

Modified: branches/SAMBA_4_0/source/ntvfs/posix/pvfs_shortname.c
===================================================================
--- branches/SAMBA_4_0/source/ntvfs/posix/pvfs_shortname.c	2004-10-02 12:30:02 UTC (rev 2787)
+++ branches/SAMBA_4_0/source/ntvfs/posix/pvfs_shortname.c	2004-10-02 13:29:20 UTC (rev 2788)
@@ -38,8 +38,10 @@
   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;
 }



More information about the samba-cvs mailing list