svn commit: samba r24411 - in branches/SAMBA_3_2_0/source: libsmb rpc_parse

derrell at samba.org derrell at samba.org
Tue Aug 14 14:28:04 GMT 2007


Author: derrell
Date: 2007-08-14 14:28:04 +0000 (Tue, 14 Aug 2007)
New Revision: 24411

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=24411

Log:
- I got tricked by function naming.  Contrary to what seemed obvious to me,
  prs_mem_free() is not the function to be called to free memory allocated by
  prs_alloc_mem().  I've added a comment so others may not get bitten too.

- Remove incorrect memory free calls added yesterday to replace SAFE_FREE.
  The memory is actually now on a talloc context, so gets freed by the caller
  when that context is freed.  We don't need to free it iternally.

Derrell

Modified:
   branches/SAMBA_3_2_0/source/libsmb/libsmbclient.c
   branches/SAMBA_3_2_0/source/rpc_parse/parse_prs.c


Changeset:
Modified: branches/SAMBA_3_2_0/source/libsmb/libsmbclient.c
===================================================================
--- branches/SAMBA_3_2_0/source/libsmb/libsmbclient.c	2007-08-14 14:27:42 UTC (rev 24410)
+++ branches/SAMBA_3_2_0/source/libsmb/libsmbclient.c	2007-08-14 14:28:04 UTC (rev 24411)
@@ -5152,8 +5152,6 @@
 	switch (mode) {
 	case SMBC_XATTR_MODE_REMOVE_ALL:
                 old->dacl->num_aces = 0;
-                prs_mem_free(old->dacl->aces);
-                prs_mem_free(&old->dacl);
                 old->dacl = NULL;
                 dacl = old->dacl;
                 break;
@@ -5172,8 +5170,6 @@
 					}
 					old->dacl->num_aces--;
 					if (old->dacl->num_aces == 0) {
-                                                prs_mem_free(&old->dacl->aces);
-                                                prs_mem_free(&old->dacl);
 						old->dacl = NULL;
 					}
 					found = True;

Modified: branches/SAMBA_3_2_0/source/rpc_parse/parse_prs.c
===================================================================
--- branches/SAMBA_3_2_0/source/rpc_parse/parse_prs.c	2007-08-14 14:27:42 UTC (rev 24410)
+++ branches/SAMBA_3_2_0/source/rpc_parse/parse_prs.c	2007-08-14 14:28:04 UTC (rev 24411)
@@ -122,6 +122,10 @@
 
 /*******************************************************************
  Delete the memory in a parse structure - if we own it.
+
+ NOTE: Contrary to the somewhat confusing naming, this function is not
+       intended for freeing memory allocated by prs_alloc_mem().  That memory
+       is attached to the talloc context given by ps->mem_ctx.
  ********************************************************************/
 
 void prs_mem_free(prs_struct *ps)



More information about the samba-cvs mailing list