summaryrefslogtreecommitdiff
path: root/source3/rpc_server/srv_spoolss_nt.c
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2000-05-28 23:00:23 +0000
committerAndrew Tridgell <tridge@samba.org>2000-05-28 23:00:23 +0000
commit38b32fb97f5a91f09a6e41b6c14aafb510bbbe6a (patch)
tree857e200390857ce46237c147e466aea51a4767a8 /source3/rpc_server/srv_spoolss_nt.c
parent0c396eef79b83d7ecb99b63d5b6592f60ed9c276 (diff)
downloadsamba-38b32fb97f5a91f09a6e41b6c14aafb510bbbe6a.tar.gz
samba-38b32fb97f5a91f09a6e41b6c14aafb510bbbe6a.tar.bz2
samba-38b32fb97f5a91f09a6e41b6c14aafb510bbbe6a.zip
don't free a driver structure from the stack!
(This used to be commit d241f1dcaf612881a428dd578b97383d02a4d3c3)
Diffstat (limited to 'source3/rpc_server/srv_spoolss_nt.c')
-rw-r--r--source3/rpc_server/srv_spoolss_nt.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/source3/rpc_server/srv_spoolss_nt.c b/source3/rpc_server/srv_spoolss_nt.c
index 25d8f63aef..fbf5bc88bf 100644
--- a/source3/rpc_server/srv_spoolss_nt.c
+++ b/source3/rpc_server/srv_spoolss_nt.c
@@ -3406,19 +3406,21 @@ static uint32 enumprinterdrivers_level1(fstring *list, fstring servername, fstri
static uint32 enumprinterdrivers_level2(fstring *list, fstring servername, fstring architecture, NEW_BUFFER *buffer, uint32 offered, uint32 *needed, uint32 *returned)
{
int i;
- NT_PRINTER_DRIVER_INFO_LEVEL driver;
DRIVER_INFO_2 *driver_info_2=NULL;
- ZERO_STRUCT(driver);
-
if (*returned > 0 &&
!(driver_info_2=(DRIVER_INFO_2 *)malloc(*returned * sizeof(DRIVER_INFO_2))))
return ERROR_NOT_ENOUGH_MEMORY;
for (i=0; i<*returned; i++) {
- get_a_printer_driver(&driver, 3, list[i], architecture);
+ NT_PRINTER_DRIVER_INFO_LEVEL driver;
+ ZERO_STRUCT(driver);
+ if (get_a_printer_driver(&driver, 3, list[i], architecture)
+ != 0) {
+ *returned = i;
+ break;
+ }
fill_printer_driver_info_2(&(driver_info_2[i]), driver, servername, architecture );
- free_a_printer_driver(driver, 3);
}
safe_free(list);