summaryrefslogtreecommitdiff
path: root/source3/rpc_server/srv_spoolss_nt.c
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2000-06-05 20:55:57 +0000
committerJeremy Allison <jra@samba.org>2000-06-05 20:55:57 +0000
commit6d8c131f50e708d4c009355a7c5fe026cf8d350a (patch)
tree11ecc2ee4fc959dd96feef8f05c5774a5cf5a4ed /source3/rpc_server/srv_spoolss_nt.c
parentf87246df627f0d940b45f65f812c0c77a2dfa355 (diff)
downloadsamba-6d8c131f50e708d4c009355a7c5fe026cf8d350a.tar.gz
samba-6d8c131f50e708d4c009355a7c5fe026cf8d350a.tar.bz2
samba-6d8c131f50e708d4c009355a7c5fe026cf8d350a.zip
Some tidyup fixes (memory leaks etc.). Still no progress with the
"no driver" issue. I'm banging my head against comparitive packet dumps right now... Jeremy. (This used to be commit 03cd4aa1443acd958593f37c61ff9c90a43c660b)
Diffstat (limited to 'source3/rpc_server/srv_spoolss_nt.c')
-rw-r--r--source3/rpc_server/srv_spoolss_nt.c29
1 files changed, 19 insertions, 10 deletions
diff --git a/source3/rpc_server/srv_spoolss_nt.c b/source3/rpc_server/srv_spoolss_nt.c
index 8015b9e4f8..8dca09dc95 100644
--- a/source3/rpc_server/srv_spoolss_nt.c
+++ b/source3/rpc_server/srv_spoolss_nt.c
@@ -773,13 +773,17 @@ static BOOL getprinterdata_printer(const POLICY_HND *handle,
DEBUG(5,("getprinterdata_printer:allocating %d\n", in_size));
- if((*data = (uint8 *)malloc( in_size *sizeof(uint8) )) == NULL) {
- return False;
- }
+ if (in_size) {
+ if((*data = (uint8 *)malloc( in_size *sizeof(uint8) )) == NULL) {
+ return False;
+ }
- memset(*data, 0, in_size *sizeof(uint8));
- /* copy the min(in_size, len) */
- memcpy(*data, idata, (len>in_size)?in_size:len *sizeof(uint8));
+ memset(*data, 0, in_size *sizeof(uint8));
+ /* copy the min(in_size, len) */
+ memcpy(*data, idata, (len>in_size)?in_size:len *sizeof(uint8));
+ } else {
+ *data = NULL;
+ }
*needed = len;
@@ -835,9 +839,14 @@ uint32 _spoolss_getprinterdata(const POLICY_HND *handle, UNISTR2 *valuename,
if (found==False) {
DEBUG(5, ("value not found, allocating %d\n", *out_size));
/* reply this param doesn't exist */
- if((*data=(uint8 *)malloc(*out_size*sizeof(uint8))) == NULL)
- return ERROR_NOT_ENOUGH_MEMORY;
- memset(*data, 0x0, *out_size*sizeof(uint8));
+ if (*out_size) {
+ if((*data=(uint8 *)malloc(*out_size*sizeof(uint8))) == NULL)
+ return ERROR_NOT_ENOUGH_MEMORY;
+ memset(*data, '\0', *out_size*sizeof(uint8));
+ } else {
+ *data = NULL;
+ }
+
return ERROR_INVALID_PARAMETER;
}
@@ -3102,8 +3111,8 @@ uint32 _spoolss_fcpn(const POLICY_HND *handle)
Printer->notify.options=0;
Printer->notify.localmachine[0]='\0';
Printer->notify.printerlocal=0;
- safe_free(Printer->notify.option);
safe_free(Printer->notify.option->ctr.type);
+ safe_free(Printer->notify.option);
Printer->notify.option=NULL;
return NT_STATUS_NO_PROBLEMO;