svn commit: samba r11235 - branches/SAMBA_3_0/source/rpc_server trunk/source/rpc_server

jerry at samba.org jerry at samba.org
Thu Oct 20 20:26:13 GMT 2005


Author: jerry
Date: 2005-10-20 20:26:11 +0000 (Thu, 20 Oct 2005)
New Revision: 11235

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

Log:
fix segfault in addprinter due to mixing talloc() and malloc()'d memory
Modified:
   branches/SAMBA_3_0/source/rpc_server/srv_spoolss_nt.c
   trunk/source/rpc_server/srv_spoolss_nt.c


Changeset:
Modified: branches/SAMBA_3_0/source/rpc_server/srv_spoolss_nt.c
===================================================================
--- branches/SAMBA_3_0/source/rpc_server/srv_spoolss_nt.c	2005-10-20 18:16:38 UTC (rev 11234)
+++ branches/SAMBA_3_0/source/rpc_server/srv_spoolss_nt.c	2005-10-20 20:26:11 UTC (rev 11235)
@@ -7413,13 +7413,11 @@
 	int	snum;
 	WERROR err = WERR_OK;
 
-	if ((printer = SMB_MALLOC_P(NT_PRINTER_INFO_LEVEL)) == NULL) {
+	if ( !(printer = TALLOC_ZERO_P(NULL, NT_PRINTER_INFO_LEVEL)) ) {
 		DEBUG(0,("spoolss_addprinterex_level_2: malloc fail.\n"));
 		return WERR_NOMEM;
 	}
 
-	ZERO_STRUCTP(printer);
-
 	/* convert from UNICODE to ASCII - this allocates the info_2 struct inside *printer.*/
 	if (!convert_printer_info(info, printer, 2)) {
 		free_a_printer(&printer, 2);

Modified: trunk/source/rpc_server/srv_spoolss_nt.c
===================================================================
--- trunk/source/rpc_server/srv_spoolss_nt.c	2005-10-20 18:16:38 UTC (rev 11234)
+++ trunk/source/rpc_server/srv_spoolss_nt.c	2005-10-20 20:26:11 UTC (rev 11235)
@@ -7413,13 +7413,11 @@
 	int	snum;
 	WERROR err = WERR_OK;
 
-	if ((printer = SMB_MALLOC_P(NT_PRINTER_INFO_LEVEL)) == NULL) {
+	if ( !(printer = TALLOC_ZERO_P(NULL, NT_PRINTER_INFO_LEVEL)) ) {
 		DEBUG(0,("spoolss_addprinterex_level_2: malloc fail.\n"));
 		return WERR_NOMEM;
 	}
 
-	ZERO_STRUCTP(printer);
-
 	/* convert from UNICODE to ASCII - this allocates the info_2 struct inside *printer.*/
 	if (!convert_printer_info(info, printer, 2)) {
 		free_a_printer(&printer, 2);



More information about the samba-cvs mailing list