diff options
author | Gerald Carter <jerry@samba.org> | 2002-12-17 21:36:31 +0000 |
---|---|---|
committer | Gerald Carter <jerry@samba.org> | 2002-12-17 21:36:31 +0000 |
commit | 1c318819cc043b472596186b255d75b12f8abbf8 (patch) | |
tree | e8912efaaaa647246c66f8c107fb25b53b18b168 /source3/rpc_server | |
parent | 81c720cc69138b038b005c85910c4eb09e885bc7 (diff) | |
download | samba-1c318819cc043b472596186b255d75b12f8abbf8.tar.gz samba-1c318819cc043b472596186b255d75b12f8abbf8.tar.bz2 samba-1c318819cc043b472596186b255d75b12f8abbf8.zip |
* fix memory leak when constructing an driver_level_6 structure
and no dependent files (working on smbd memory leak). No CR# yet.
(This used to be commit 416fd947da4463f5d4dc336dfddf5ce35f50fae9)
Diffstat (limited to 'source3/rpc_server')
-rw-r--r-- | source3/rpc_server/srv_spoolss_nt.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/source3/rpc_server/srv_spoolss_nt.c b/source3/rpc_server/srv_spoolss_nt.c index 6dd4352cbc..751ff00a04 100644 --- a/source3/rpc_server/srv_spoolss_nt.c +++ b/source3/rpc_server/srv_spoolss_nt.c @@ -4929,7 +4929,9 @@ static uint32 init_unistr_array(uint16 **uni_array, fstring *char_array, char *s DEBUGADD(6,("%d:%s:%d\n", i, line, strlen(line))); - if ( (tuary=Realloc(*uni_array, (j+strlen(line)+2)*sizeof(uint16))) == NULL ) { + /* add one extra unit16 for the second terminating NULL */ + + if ( (tuary=Realloc(*uni_array, (j+1+strlen(line)+2)*sizeof(uint16))) == NULL ) { DEBUG(2,("init_unistr_array: Realloc error\n" )); return 0; } else @@ -4943,6 +4945,9 @@ static uint32 init_unistr_array(uint16 **uni_array, fstring *char_array, char *s } if (*uni_array) { + /* special case for ""; we need to add both NULL's here */ + if (!j) + (*uni_array)[j++]=0x0000; (*uni_array)[j]=0x0000; } @@ -5172,6 +5177,7 @@ static WERROR construct_printer_driver_info_6(DRIVER_INFO_6 *info, int snum, fill_printer_driver_info_6(info, driver, servername); free_a_printer(&printer,2); + free_a_printer_driver(driver, 3); return WERR_OK; } |