From d836024b2816f37abd523afb3b2d4f2bfb130f0a Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Mon, 11 Sep 2000 23:43:44 +0000 Subject: Fixed memory leaks found in enumprinterdrivers code. Jeremy. (This used to be commit e08b521559a824da09b0b73a04e462c573c42b06) --- source3/printing/nt_printing.c | 6 +++--- source3/rpc_server/srv_spoolss_nt.c | 13 ++++++++----- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/source3/printing/nt_printing.c b/source3/printing/nt_printing.c index a39ca39778..9e4f1c2fd5 100644 --- a/source3/printing/nt_printing.c +++ b/source3/printing/nt_printing.c @@ -1819,8 +1819,7 @@ uint32 get_a_printer_driver(NT_PRINTER_DRIVER_INFO_LEVEL *driver, uint32 level, { case 3: { - success=get_a_printer_driver_3(&(driver->info_3), - printername, + success=get_a_printer_driver_3(&driver->info_3, printername, architecture, version); break; } @@ -1829,7 +1828,8 @@ uint32 get_a_printer_driver(NT_PRINTER_DRIVER_INFO_LEVEL *driver, uint32 level, break; } - if (success == 0) dump_a_printer_driver(*driver, level); + if (success == 0) + dump_a_printer_driver(*driver, level); return (success); } diff --git a/source3/rpc_server/srv_spoolss_nt.c b/source3/rpc_server/srv_spoolss_nt.c index da5b3e960f..7f7a75fc5c 100644 --- a/source3/rpc_server/srv_spoolss_nt.c +++ b/source3/rpc_server/srv_spoolss_nt.c @@ -3677,7 +3677,8 @@ static uint32 enumprinterdrivers_level1(fstring servername, fstring architecture DEBUGADD(5,("\tdriver: [%s]\n", list[i])); ZERO_STRUCT(driver); get_a_printer_driver(&driver, 3, list[i], architecture, version); - fill_printer_driver_info_1(&(driver_info_1[*returned+i]), driver, servername, architecture ); + fill_printer_driver_info_1(&driver_info_1[*returned+i], driver, servername, architecture ); + free_a_printer_driver(driver, 3); } *returned+=ndrivers; @@ -3687,7 +3688,7 @@ static uint32 enumprinterdrivers_level1(fstring servername, fstring architecture /* check the required size. */ for (i=0; i<*returned; i++) { DEBUGADD(6,("adding driver [%d]'s size\n",i)); - *needed += spoolss_size_printer_driver_info_1(&(driver_info_1[i])); + *needed += spoolss_size_printer_driver_info_1(&driver_info_1[i]); } if (!alloc_buffer_size(buffer, *needed)) { @@ -3698,7 +3699,7 @@ static uint32 enumprinterdrivers_level1(fstring servername, fstring architecture /* fill the buffer with the form structures */ for (i=0; i<*returned; i++) { DEBUGADD(6,("adding driver [%d] to buffer\n",i)); - new_smb_io_printer_driver_info_1("", buffer, &(driver_info_1[i]), 0); + new_smb_io_printer_driver_info_1("", buffer, &driver_info_1[i], 0); } safe_free(driver_info_1); @@ -3747,7 +3748,8 @@ static uint32 enumprinterdrivers_level2(fstring servername, fstring architecture DEBUGADD(5,("\tdriver: [%s]\n", list[i])); ZERO_STRUCT(driver); get_a_printer_driver(&driver, 3, list[i], architecture, version); - fill_printer_driver_info_2(&(driver_info_2[*returned+i]), driver, servername); + fill_printer_driver_info_2(&driver_info_2[*returned+i], driver, servername); + free_a_printer_driver(driver, 3); } *returned+=ndrivers; @@ -3817,7 +3819,8 @@ static uint32 enumprinterdrivers_level3(fstring servername, fstring architecture DEBUGADD(5,("\tdriver: [%s]\n", list[i])); ZERO_STRUCT(driver); get_a_printer_driver(&driver, 3, list[i], architecture, version); - fill_printer_driver_info_3(&(driver_info_3[*returned+i]), driver, servername); + fill_printer_driver_info_3(&driver_info_3[*returned+i], driver, servername); + free_a_printer_driver(driver, 3); } *returned+=ndrivers; -- cgit