Lines 238-244
Link Here
|
238 |
if (!sp) |
238 |
if (!sp) |
239 |
return NULL; |
239 |
return NULL; |
240 |
|
240 |
|
241 |
new_sp = (SPOOL_NOTIFY_OPTION *)malloc(sizeof(SPOOL_NOTIFY_OPTION)); |
241 |
new_sp = SMB_MALLOC_P(SPOOL_NOTIFY_OPTION); |
242 |
if (!new_sp) |
242 |
if (!new_sp) |
243 |
return NULL; |
243 |
return NULL; |
244 |
|
244 |
|
Lines 595-601
Link Here
|
595 |
|
595 |
|
596 |
DEBUG(10,("open_printer_hnd: name [%s]\n", name)); |
596 |
DEBUG(10,("open_printer_hnd: name [%s]\n", name)); |
597 |
|
597 |
|
598 |
if((new_printer=(Printer_entry *)malloc(sizeof(Printer_entry))) == NULL) |
598 |
if((new_printer=SMB_MALLOC_P(Printer_entry)) == NULL) |
599 |
return False; |
599 |
return False; |
600 |
|
600 |
|
601 |
ZERO_STRUCTP(new_printer); |
601 |
ZERO_STRUCTP(new_printer); |
Lines 743-749
Link Here
|
743 |
init_unistr2(&unistr, msg->notify.data, UNI_STR_TERMINATE); |
743 |
init_unistr2(&unistr, msg->notify.data, UNI_STR_TERMINATE); |
744 |
|
744 |
|
745 |
data->notify_data.data.length = msg->len * 2; |
745 |
data->notify_data.data.length = msg->len * 2; |
746 |
data->notify_data.data.string = (uint16 *)talloc(mem_ctx, msg->len * 2); |
746 |
data->notify_data.data.string = TALLOC_ARRAY(mem_ctx, uint16, msg->len); |
747 |
|
747 |
|
748 |
if (!data->notify_data.data.string) { |
748 |
if (!data->notify_data.data.string) { |
749 |
data->notify_data.data.length = 0; |
749 |
data->notify_data.data.length = 0; |
Lines 780-786
Link Here
|
780 |
return; |
780 |
return; |
781 |
|
781 |
|
782 |
data->notify_data.data.length = prs_offset(&ps); |
782 |
data->notify_data.data.length = prs_offset(&ps); |
783 |
data->notify_data.data.string = talloc(mem_ctx, prs_offset(&ps)); |
783 |
data->notify_data.data.string = TALLOC(mem_ctx, prs_offset(&ps)); |
784 |
|
784 |
|
785 |
prs_copy_all_data_out((char *)data->notify_data.data.string, &ps); |
785 |
prs_copy_all_data_out((char *)data->notify_data.data.string, &ps); |
786 |
|
786 |
|
Lines 938-944
Link Here
|
938 |
if ( i == ctr->num_groups ) { |
938 |
if ( i == ctr->num_groups ) { |
939 |
ctr->num_groups++; |
939 |
ctr->num_groups++; |
940 |
|
940 |
|
941 |
if ( !(groups = talloc_realloc( ctr->ctx, ctr->msg_groups, sizeof(SPOOLSS_NOTIFY_MSG_GROUP)*ctr->num_groups)) ) { |
941 |
if ( !(groups = TALLOC_REALLOC_ARRAY( ctr->ctx, ctr->msg_groups, SPOOLSS_NOTIFY_MSG_GROUP, ctr->num_groups)) ) { |
942 |
DEBUG(0,("notify_msg_ctr_addmsg: talloc_realloc() failed!\n")); |
942 |
DEBUG(0,("notify_msg_ctr_addmsg: talloc_realloc() failed!\n")); |
943 |
return 0; |
943 |
return 0; |
944 |
} |
944 |
} |
Lines 956-962
Link Here
|
956 |
|
956 |
|
957 |
msg_grp->num_msgs++; |
957 |
msg_grp->num_msgs++; |
958 |
|
958 |
|
959 |
if ( !(msg_list = talloc_realloc( ctr->ctx, msg_grp->msgs, sizeof(SPOOLSS_NOTIFY_MSG)*msg_grp->num_msgs )) ) { |
959 |
if ( !(msg_list = TALLOC_REALLOC_ARRAY( ctr->ctx, msg_grp->msgs, SPOOLSS_NOTIFY_MSG, msg_grp->num_msgs )) ) { |
960 |
DEBUG(0,("notify_msg_ctr_addmsg: talloc_realloc() failed for new message [%d]!\n", msg_grp->num_msgs)); |
960 |
DEBUG(0,("notify_msg_ctr_addmsg: talloc_realloc() failed for new message [%d]!\n", msg_grp->num_msgs)); |
961 |
return 0; |
961 |
return 0; |
962 |
} |
962 |
} |
Lines 968-974
Link Here
|
968 |
/* need to allocate own copy of data */ |
968 |
/* need to allocate own copy of data */ |
969 |
|
969 |
|
970 |
if ( msg->len != 0 ) |
970 |
if ( msg->len != 0 ) |
971 |
msg_grp->msgs[new_slot].notify.data = talloc_memdup( ctr->ctx, msg->notify.data, msg->len ); |
971 |
msg_grp->msgs[new_slot].notify.data = TALLOC_MEMDUP( ctr->ctx, msg->notify.data, msg->len ); |
972 |
|
972 |
|
973 |
return ctr->num_groups; |
973 |
return ctr->num_groups; |
974 |
} |
974 |
} |
Lines 1026-1032
Link Here
|
1026 |
|
1026 |
|
1027 |
/* allocate the max entries possible */ |
1027 |
/* allocate the max entries possible */ |
1028 |
|
1028 |
|
1029 |
data = talloc( mem_ctx, msg_group->num_msgs*sizeof(SPOOL_NOTIFY_INFO_DATA) ); |
1029 |
data = TALLOC_ARRAY( mem_ctx, SPOOL_NOTIFY_INFO_DATA, msg_group->num_msgs); |
1030 |
ZERO_STRUCTP(data); |
1030 |
ZERO_STRUCTP(data); |
1031 |
|
1031 |
|
1032 |
/* build the array of change notifications */ |
1032 |
/* build the array of change notifications */ |
Lines 1446-1452
Link Here
|
1446 |
|
1446 |
|
1447 |
/* bulk copy first */ |
1447 |
/* bulk copy first */ |
1448 |
|
1448 |
|
1449 |
d = talloc_memdup(ctx, devmode, sizeof(DEVICEMODE)); |
1449 |
d = TALLOC_MEMDUP(ctx, devmode, sizeof(DEVICEMODE)); |
1450 |
if (!d) |
1450 |
if (!d) |
1451 |
return NULL; |
1451 |
return NULL; |
1452 |
|
1452 |
|
Lines 1454-1460
Link Here
|
1454 |
|
1454 |
|
1455 |
len = unistrlen(devmode->devicename.buffer); |
1455 |
len = unistrlen(devmode->devicename.buffer); |
1456 |
if (len != -1) { |
1456 |
if (len != -1) { |
1457 |
d->devicename.buffer = talloc(ctx, len*2); |
1457 |
d->devicename.buffer = TALLOC_ARRAY(ctx, uint16, len); |
1458 |
if (unistrcpy(d->devicename.buffer, devmode->devicename.buffer) != len) |
1458 |
if (unistrcpy(d->devicename.buffer, devmode->devicename.buffer) != len) |
1459 |
return NULL; |
1459 |
return NULL; |
1460 |
} |
1460 |
} |
Lines 1462-1473
Link Here
|
1462 |
|
1462 |
|
1463 |
len = unistrlen(devmode->formname.buffer); |
1463 |
len = unistrlen(devmode->formname.buffer); |
1464 |
if (len != -1) { |
1464 |
if (len != -1) { |
1465 |
d->devicename.buffer = talloc(ctx, len*2); |
1465 |
d->devicename.buffer = TALLOC_ARRAY(ctx, uint16, len); |
1466 |
if (unistrcpy(d->formname.buffer, devmode->formname.buffer) != len) |
1466 |
if (unistrcpy(d->formname.buffer, devmode->formname.buffer) != len) |
1467 |
return NULL; |
1467 |
return NULL; |
1468 |
} |
1468 |
} |
1469 |
|
1469 |
|
1470 |
d->private = talloc_memdup(ctx, devmode->private, devmode->driverextra); |
1470 |
d->private = TALLOC_MEMDUP(ctx, devmode->private, devmode->driverextra); |
1471 |
|
1471 |
|
1472 |
return d; |
1472 |
return d; |
1473 |
} |
1473 |
} |
Lines 1904-1910
Link Here
|
1904 |
if ((devmode->driverextra != 0) && (devmode->private != NULL)) { |
1904 |
if ((devmode->driverextra != 0) && (devmode->private != NULL)) { |
1905 |
SAFE_FREE(nt_devmode->private); |
1905 |
SAFE_FREE(nt_devmode->private); |
1906 |
nt_devmode->driverextra=devmode->driverextra; |
1906 |
nt_devmode->driverextra=devmode->driverextra; |
1907 |
if((nt_devmode->private=(uint8 *)malloc(nt_devmode->driverextra * sizeof(uint8))) == NULL) |
1907 |
if((nt_devmode->private=SMB_MALLOC_ARRAY(uint8, nt_devmode->driverextra)) == NULL) |
1908 |
return False; |
1908 |
return False; |
1909 |
memcpy(nt_devmode->private, devmode->private, nt_devmode->driverextra); |
1909 |
memcpy(nt_devmode->private, devmode->private, nt_devmode->driverextra); |
1910 |
} |
1910 |
} |
Lines 2245-2255
Link Here
|
2245 |
|
2245 |
|
2246 |
/* special case for 0 length values */ |
2246 |
/* special case for 0 length values */ |
2247 |
if ( data_len ) { |
2247 |
if ( data_len ) { |
2248 |
if ( (*data = (uint8 *)talloc_memdup(ctx, regval_data_p(val), data_len)) == NULL ) |
2248 |
if ( (*data = (uint8 *)TALLOC_MEMDUP(ctx, regval_data_p(val), data_len)) == NULL ) |
2249 |
return WERR_NOMEM; |
2249 |
return WERR_NOMEM; |
2250 |
} |
2250 |
} |
2251 |
else { |
2251 |
else { |
2252 |
if ( (*data = (uint8 *)talloc_zero(ctx, in_size)) == NULL ) |
2252 |
if ( (*data = (uint8 *)TALLOC_ZERO(ctx, in_size)) == NULL ) |
2253 |
return WERR_NOMEM; |
2253 |
return WERR_NOMEM; |
2254 |
} |
2254 |
} |
2255 |
} |
2255 |
} |
Lines 2296-2302
Link Here
|
2296 |
|
2296 |
|
2297 |
if (!StrCaseCmp(value, "W3SvcInstalled")) { |
2297 |
if (!StrCaseCmp(value, "W3SvcInstalled")) { |
2298 |
*type = 0x4; |
2298 |
*type = 0x4; |
2299 |
if((*data = (uint8 *)talloc_zero(ctx, 4*sizeof(uint8) )) == NULL) |
2299 |
if((*data = (uint8 *)TALLOC_ZERO(ctx, 4*sizeof(uint8) )) == NULL) |
2300 |
return WERR_NOMEM; |
2300 |
return WERR_NOMEM; |
2301 |
*needed = 0x4; |
2301 |
*needed = 0x4; |
2302 |
return WERR_OK; |
2302 |
return WERR_OK; |
Lines 2304-2310
Link Here
|
2304 |
|
2304 |
|
2305 |
if (!StrCaseCmp(value, "BeepEnabled")) { |
2305 |
if (!StrCaseCmp(value, "BeepEnabled")) { |
2306 |
*type = 0x4; |
2306 |
*type = 0x4; |
2307 |
if((*data = (uint8 *)talloc(ctx, 4*sizeof(uint8) )) == NULL) |
2307 |
if((*data = (uint8 *)TALLOC(ctx, 4*sizeof(uint8) )) == NULL) |
2308 |
return WERR_NOMEM; |
2308 |
return WERR_NOMEM; |
2309 |
SIVAL(*data, 0, 0x00); |
2309 |
SIVAL(*data, 0, 0x00); |
2310 |
*needed = 0x4; |
2310 |
*needed = 0x4; |
Lines 2313-2319
Link Here
|
2313 |
|
2313 |
|
2314 |
if (!StrCaseCmp(value, "EventLog")) { |
2314 |
if (!StrCaseCmp(value, "EventLog")) { |
2315 |
*type = 0x4; |
2315 |
*type = 0x4; |
2316 |
if((*data = (uint8 *)talloc(ctx, 4*sizeof(uint8) )) == NULL) |
2316 |
if((*data = (uint8 *)TALLOC(ctx, 4 )) == NULL) |
2317 |
return WERR_NOMEM; |
2317 |
return WERR_NOMEM; |
2318 |
/* formally was 0x1b */ |
2318 |
/* formally was 0x1b */ |
2319 |
SIVAL(*data, 0, 0x0); |
2319 |
SIVAL(*data, 0, 0x0); |
Lines 2323-2329
Link Here
|
2323 |
|
2323 |
|
2324 |
if (!StrCaseCmp(value, "NetPopup")) { |
2324 |
if (!StrCaseCmp(value, "NetPopup")) { |
2325 |
*type = 0x4; |
2325 |
*type = 0x4; |
2326 |
if((*data = (uint8 *)talloc(ctx, 4*sizeof(uint8) )) == NULL) |
2326 |
if((*data = (uint8 *)TALLOC(ctx, 4 )) == NULL) |
2327 |
return WERR_NOMEM; |
2327 |
return WERR_NOMEM; |
2328 |
SIVAL(*data, 0, 0x00); |
2328 |
SIVAL(*data, 0, 0x00); |
2329 |
*needed = 0x4; |
2329 |
*needed = 0x4; |
Lines 2332-2338
Link Here
|
2332 |
|
2332 |
|
2333 |
if (!StrCaseCmp(value, "MajorVersion")) { |
2333 |
if (!StrCaseCmp(value, "MajorVersion")) { |
2334 |
*type = 0x4; |
2334 |
*type = 0x4; |
2335 |
if((*data = (uint8 *)talloc(ctx, 4*sizeof(uint8) )) == NULL) |
2335 |
if((*data = (uint8 *)TALLOC(ctx, 4 )) == NULL) |
2336 |
return WERR_NOMEM; |
2336 |
return WERR_NOMEM; |
2337 |
|
2337 |
|
2338 |
/* Windows NT 4.0 seems to not allow uploading of drivers |
2338 |
/* Windows NT 4.0 seems to not allow uploading of drivers |
Lines 2351-2357
Link Here
|
2351 |
|
2351 |
|
2352 |
if (!StrCaseCmp(value, "MinorVersion")) { |
2352 |
if (!StrCaseCmp(value, "MinorVersion")) { |
2353 |
*type = 0x4; |
2353 |
*type = 0x4; |
2354 |
if((*data = (uint8 *)talloc(ctx, 4*sizeof(uint8) )) == NULL) |
2354 |
if((*data = (uint8 *)TALLOC(ctx, 4 )) == NULL) |
2355 |
return WERR_NOMEM; |
2355 |
return WERR_NOMEM; |
2356 |
SIVAL(*data, 0, 0); |
2356 |
SIVAL(*data, 0, 0); |
2357 |
*needed = 0x4; |
2357 |
*needed = 0x4; |
Lines 2369-2375
Link Here
|
2369 |
*type = 0x3; |
2369 |
*type = 0x3; |
2370 |
*needed = 0x114; |
2370 |
*needed = 0x114; |
2371 |
|
2371 |
|
2372 |
if((*data = (uint8 *)talloc(ctx, (*needed)*sizeof(uint8) )) == NULL) |
2372 |
if((*data = (uint8 *)TALLOC(ctx, *needed)) == NULL) |
2373 |
return WERR_NOMEM; |
2373 |
return WERR_NOMEM; |
2374 |
ZERO_STRUCTP( *data ); |
2374 |
ZERO_STRUCTP( *data ); |
2375 |
|
2375 |
|
Lines 2388-2394
Link Here
|
2388 |
const char *string="C:\\PRINTERS"; |
2388 |
const char *string="C:\\PRINTERS"; |
2389 |
*type = 0x1; |
2389 |
*type = 0x1; |
2390 |
*needed = 2*(strlen(string)+1); |
2390 |
*needed = 2*(strlen(string)+1); |
2391 |
if((*data = (uint8 *)talloc(ctx, ((*needed > in_size) ? *needed:in_size) *sizeof(uint8))) == NULL) |
2391 |
if((*data = (uint8 *)TALLOC(ctx, (*needed > in_size) ? *needed:in_size )) == NULL) |
2392 |
return WERR_NOMEM; |
2392 |
return WERR_NOMEM; |
2393 |
memset(*data, 0, (*needed > in_size) ? *needed:in_size); |
2393 |
memset(*data, 0, (*needed > in_size) ? *needed:in_size); |
2394 |
|
2394 |
|
Lines 2404-2410
Link Here
|
2404 |
const char *string="Windows NT x86"; |
2404 |
const char *string="Windows NT x86"; |
2405 |
*type = 0x1; |
2405 |
*type = 0x1; |
2406 |
*needed = 2*(strlen(string)+1); |
2406 |
*needed = 2*(strlen(string)+1); |
2407 |
if((*data = (uint8 *)talloc(ctx, ((*needed > in_size) ? *needed:in_size) *sizeof(uint8))) == NULL) |
2407 |
if((*data = (uint8 *)TALLOC(ctx, (*needed > in_size) ? *needed:in_size )) == NULL) |
2408 |
return WERR_NOMEM; |
2408 |
return WERR_NOMEM; |
2409 |
memset(*data, 0, (*needed > in_size) ? *needed:in_size); |
2409 |
memset(*data, 0, (*needed > in_size) ? *needed:in_size); |
2410 |
for (i=0; i<strlen(string); i++) { |
2410 |
for (i=0; i<strlen(string); i++) { |
Lines 2416-2422
Link Here
|
2416 |
|
2416 |
|
2417 |
if (!StrCaseCmp(value, "DsPresent")) { |
2417 |
if (!StrCaseCmp(value, "DsPresent")) { |
2418 |
*type = 0x4; |
2418 |
*type = 0x4; |
2419 |
if((*data = (uint8 *)talloc(ctx, 4*sizeof(uint8) )) == NULL) |
2419 |
if((*data = (uint8 *)TALLOC(ctx, 4 )) == NULL) |
2420 |
return WERR_NOMEM; |
2420 |
return WERR_NOMEM; |
2421 |
SIVAL(*data, 0, 0x01); |
2421 |
SIVAL(*data, 0, 0x01); |
2422 |
*needed = 0x4; |
2422 |
*needed = 0x4; |
Lines 2430-2436
Link Here
|
2430 |
return WERR_BADFILE; |
2430 |
return WERR_BADFILE; |
2431 |
*type = 0x1; |
2431 |
*type = 0x1; |
2432 |
*needed = 2*(strlen(hostname)+1); |
2432 |
*needed = 2*(strlen(hostname)+1); |
2433 |
if((*data = (uint8 *)talloc(ctx, ((*needed > in_size) ? *needed:in_size) *sizeof(uint8))) == NULL) |
2433 |
if((*data = (uint8 *)TALLOC(ctx, (*needed > in_size) ? *needed:in_size )) == NULL) |
2434 |
return WERR_NOMEM; |
2434 |
return WERR_NOMEM; |
2435 |
memset(*data, 0, (*needed > in_size) ? *needed:in_size); |
2435 |
memset(*data, 0, (*needed > in_size) ? *needed:in_size); |
2436 |
for (i=0; i<strlen(hostname); i++) { |
2436 |
for (i=0; i<strlen(hostname); i++) { |
Lines 2505-2511
Link Here
|
2505 |
if ( strequal(value, "ChangeId") ) { |
2505 |
if ( strequal(value, "ChangeId") ) { |
2506 |
*type = REG_DWORD; |
2506 |
*type = REG_DWORD; |
2507 |
*needed = sizeof(uint32); |
2507 |
*needed = sizeof(uint32); |
2508 |
if ( (*data = (uint8*)talloc(p->mem_ctx, sizeof(uint32))) == NULL) { |
2508 |
if ( (*data = (uint8*)TALLOC(p->mem_ctx, sizeof(uint32))) == NULL) { |
2509 |
status = WERR_NOMEM; |
2509 |
status = WERR_NOMEM; |
2510 |
goto done; |
2510 |
goto done; |
2511 |
} |
2511 |
} |
Lines 2527-2533
Link Here
|
2527 |
/* reply this param doesn't exist */ |
2527 |
/* reply this param doesn't exist */ |
2528 |
|
2528 |
|
2529 |
if ( *out_size ) { |
2529 |
if ( *out_size ) { |
2530 |
if((*data=(uint8 *)talloc_zero(p->mem_ctx, *out_size*sizeof(uint8))) == NULL) { |
2530 |
if((*data=(uint8 *)TALLOC_ZERO_ARRAY(p->mem_ctx, uint8, *out_size)) == NULL) { |
2531 |
if ( printer ) |
2531 |
if ( printer ) |
2532 |
free_a_printer( &printer, 2 ); |
2532 |
free_a_printer( &printer, 2 ); |
2533 |
return WERR_NOMEM; |
2533 |
return WERR_NOMEM; |
Lines 2774-2780
Link Here
|
2774 |
len = rpcstr_push(temp, printer->info_2->servername, sizeof(temp)-2, STR_TERMINATE); |
2774 |
len = rpcstr_push(temp, printer->info_2->servername, sizeof(temp)-2, STR_TERMINATE); |
2775 |
|
2775 |
|
2776 |
data->notify_data.data.length = len; |
2776 |
data->notify_data.data.length = len; |
2777 |
data->notify_data.data.string = (uint16 *)talloc(mem_ctx, len); |
2777 |
data->notify_data.data.string = (uint16 *)TALLOC(mem_ctx, len); |
2778 |
|
2778 |
|
2779 |
if (!data->notify_data.data.string) { |
2779 |
if (!data->notify_data.data.string) { |
2780 |
data->notify_data.data.length = 0; |
2780 |
data->notify_data.data.length = 0; |
Lines 2809-2815
Link Here
|
2809 |
len = rpcstr_push(temp, p, sizeof(temp)-2, STR_TERMINATE); |
2809 |
len = rpcstr_push(temp, p, sizeof(temp)-2, STR_TERMINATE); |
2810 |
|
2810 |
|
2811 |
data->notify_data.data.length = len; |
2811 |
data->notify_data.data.length = len; |
2812 |
data->notify_data.data.string = (uint16 *)talloc(mem_ctx, len); |
2812 |
data->notify_data.data.string = (uint16 *)TALLOC(mem_ctx, len); |
2813 |
|
2813 |
|
2814 |
if (!data->notify_data.data.string) { |
2814 |
if (!data->notify_data.data.string) { |
2815 |
data->notify_data.data.length = 0; |
2815 |
data->notify_data.data.length = 0; |
Lines 2835-2841
Link Here
|
2835 |
len = rpcstr_push(temp, lp_servicename(snum), sizeof(temp)-2, STR_TERMINATE); |
2835 |
len = rpcstr_push(temp, lp_servicename(snum), sizeof(temp)-2, STR_TERMINATE); |
2836 |
|
2836 |
|
2837 |
data->notify_data.data.length = len; |
2837 |
data->notify_data.data.length = len; |
2838 |
data->notify_data.data.string = (uint16 *)talloc(mem_ctx, len); |
2838 |
data->notify_data.data.string = (uint16 *)TALLOC(mem_ctx, len); |
2839 |
|
2839 |
|
2840 |
if (!data->notify_data.data.string) { |
2840 |
if (!data->notify_data.data.string) { |
2841 |
data->notify_data.data.length = 0; |
2841 |
data->notify_data.data.length = 0; |
Lines 2863-2869
Link Here
|
2863 |
len = rpcstr_push(temp, printer->info_2->portname, sizeof(temp)-2, STR_TERMINATE); |
2863 |
len = rpcstr_push(temp, printer->info_2->portname, sizeof(temp)-2, STR_TERMINATE); |
2864 |
|
2864 |
|
2865 |
data->notify_data.data.length = len; |
2865 |
data->notify_data.data.length = len; |
2866 |
data->notify_data.data.string = (uint16 *)talloc(mem_ctx, len); |
2866 |
data->notify_data.data.string = (uint16 *)TALLOC(mem_ctx, len); |
2867 |
|
2867 |
|
2868 |
if (!data->notify_data.data.string) { |
2868 |
if (!data->notify_data.data.string) { |
2869 |
data->notify_data.data.length = 0; |
2869 |
data->notify_data.data.length = 0; |
Lines 2890-2896
Link Here
|
2890 |
len = rpcstr_push(temp, printer->info_2->drivername, sizeof(temp)-2, STR_TERMINATE); |
2890 |
len = rpcstr_push(temp, printer->info_2->drivername, sizeof(temp)-2, STR_TERMINATE); |
2891 |
|
2891 |
|
2892 |
data->notify_data.data.length = len; |
2892 |
data->notify_data.data.length = len; |
2893 |
data->notify_data.data.string = (uint16 *)talloc(mem_ctx, len); |
2893 |
data->notify_data.data.string = (uint16 *)TALLOC(mem_ctx, len); |
2894 |
|
2894 |
|
2895 |
if (!data->notify_data.data.string) { |
2895 |
if (!data->notify_data.data.string) { |
2896 |
data->notify_data.data.length = 0; |
2896 |
data->notify_data.data.length = 0; |
Lines 2919-2925
Link Here
|
2919 |
len = rpcstr_push(temp, printer->info_2->comment, sizeof(temp)-2, STR_TERMINATE); |
2919 |
len = rpcstr_push(temp, printer->info_2->comment, sizeof(temp)-2, STR_TERMINATE); |
2920 |
|
2920 |
|
2921 |
data->notify_data.data.length = len; |
2921 |
data->notify_data.data.length = len; |
2922 |
data->notify_data.data.string = (uint16 *)talloc(mem_ctx, len); |
2922 |
data->notify_data.data.string = (uint16 *)TALLOC(mem_ctx, len); |
2923 |
|
2923 |
|
2924 |
if (!data->notify_data.data.string) { |
2924 |
if (!data->notify_data.data.string) { |
2925 |
data->notify_data.data.length = 0; |
2925 |
data->notify_data.data.length = 0; |
Lines 2946-2952
Link Here
|
2946 |
len = rpcstr_push(temp, printer->info_2->location,sizeof(temp)-2, STR_TERMINATE); |
2946 |
len = rpcstr_push(temp, printer->info_2->location,sizeof(temp)-2, STR_TERMINATE); |
2947 |
|
2947 |
|
2948 |
data->notify_data.data.length = len; |
2948 |
data->notify_data.data.length = len; |
2949 |
data->notify_data.data.string = (uint16 *)talloc(mem_ctx, len); |
2949 |
data->notify_data.data.string = (uint16 *)TALLOC(mem_ctx, len); |
2950 |
|
2950 |
|
2951 |
if (!data->notify_data.data.string) { |
2951 |
if (!data->notify_data.data.string) { |
2952 |
data->notify_data.data.length = 0; |
2952 |
data->notify_data.data.length = 0; |
Lines 2985-2991
Link Here
|
2985 |
len = rpcstr_push(temp, printer->info_2->sepfile, sizeof(temp)-2, STR_TERMINATE); |
2985 |
len = rpcstr_push(temp, printer->info_2->sepfile, sizeof(temp)-2, STR_TERMINATE); |
2986 |
|
2986 |
|
2987 |
data->notify_data.data.length = len; |
2987 |
data->notify_data.data.length = len; |
2988 |
data->notify_data.data.string = (uint16 *)talloc(mem_ctx, len); |
2988 |
data->notify_data.data.string = (uint16 *)TALLOC(mem_ctx, len); |
2989 |
|
2989 |
|
2990 |
if (!data->notify_data.data.string) { |
2990 |
if (!data->notify_data.data.string) { |
2991 |
data->notify_data.data.length = 0; |
2991 |
data->notify_data.data.length = 0; |
Lines 3012-3018
Link Here
|
3012 |
len = rpcstr_push(temp, printer->info_2->printprocessor, sizeof(temp)-2, STR_TERMINATE); |
3012 |
len = rpcstr_push(temp, printer->info_2->printprocessor, sizeof(temp)-2, STR_TERMINATE); |
3013 |
|
3013 |
|
3014 |
data->notify_data.data.length = len; |
3014 |
data->notify_data.data.length = len; |
3015 |
data->notify_data.data.string = (uint16 *)talloc(mem_ctx, len); |
3015 |
data->notify_data.data.string = (uint16 *)TALLOC(mem_ctx, len); |
3016 |
|
3016 |
|
3017 |
if (!data->notify_data.data.string) { |
3017 |
if (!data->notify_data.data.string) { |
3018 |
data->notify_data.data.length = 0; |
3018 |
data->notify_data.data.length = 0; |
Lines 3039-3045
Link Here
|
3039 |
len = rpcstr_push(temp, printer->info_2->parameters, sizeof(temp)-2, STR_TERMINATE); |
3039 |
len = rpcstr_push(temp, printer->info_2->parameters, sizeof(temp)-2, STR_TERMINATE); |
3040 |
|
3040 |
|
3041 |
data->notify_data.data.length = len; |
3041 |
data->notify_data.data.length = len; |
3042 |
data->notify_data.data.string = (uint16 *)talloc(mem_ctx, len); |
3042 |
data->notify_data.data.string = (uint16 *)TALLOC(mem_ctx, len); |
3043 |
|
3043 |
|
3044 |
if (!data->notify_data.data.string) { |
3044 |
if (!data->notify_data.data.string) { |
3045 |
data->notify_data.data.length = 0; |
3045 |
data->notify_data.data.length = 0; |
Lines 3066-3072
Link Here
|
3066 |
len = rpcstr_push(temp, printer->info_2->datatype, sizeof(pstring)-2, STR_TERMINATE); |
3066 |
len = rpcstr_push(temp, printer->info_2->datatype, sizeof(pstring)-2, STR_TERMINATE); |
3067 |
|
3067 |
|
3068 |
data->notify_data.data.length = len; |
3068 |
data->notify_data.data.length = len; |
3069 |
data->notify_data.data.string = (uint16 *)talloc(mem_ctx, len); |
3069 |
data->notify_data.data.string = (uint16 *)TALLOC(mem_ctx, len); |
3070 |
|
3070 |
|
3071 |
if (!data->notify_data.data.string) { |
3071 |
if (!data->notify_data.data.string) { |
3072 |
data->notify_data.data.length = 0; |
3072 |
data->notify_data.data.length = 0; |
Lines 3226-3232
Link Here
|
3226 |
len = rpcstr_push(temp, queue->fs_user, sizeof(temp)-2, STR_TERMINATE); |
3226 |
len = rpcstr_push(temp, queue->fs_user, sizeof(temp)-2, STR_TERMINATE); |
3227 |
|
3227 |
|
3228 |
data->notify_data.data.length = len; |
3228 |
data->notify_data.data.length = len; |
3229 |
data->notify_data.data.string = (uint16 *)talloc(mem_ctx, len); |
3229 |
data->notify_data.data.string = (uint16 *)TALLOC(mem_ctx, len); |
3230 |
|
3230 |
|
3231 |
if (!data->notify_data.data.string) { |
3231 |
if (!data->notify_data.data.string) { |
3232 |
data->notify_data.data.length = 0; |
3232 |
data->notify_data.data.length = 0; |
Lines 3266-3272
Link Here
|
3266 |
len = rpcstr_push(temp, queue->fs_file, sizeof(temp)-2, STR_TERMINATE); |
3266 |
len = rpcstr_push(temp, queue->fs_file, sizeof(temp)-2, STR_TERMINATE); |
3267 |
|
3267 |
|
3268 |
data->notify_data.data.length = len; |
3268 |
data->notify_data.data.length = len; |
3269 |
data->notify_data.data.string = (uint16 *)talloc(mem_ctx, len); |
3269 |
data->notify_data.data.string = (uint16 *)TALLOC(mem_ctx, len); |
3270 |
|
3270 |
|
3271 |
if (!data->notify_data.data.string) { |
3271 |
if (!data->notify_data.data.string) { |
3272 |
data->notify_data.data.length = 0; |
3272 |
data->notify_data.data.length = 0; |
Lines 3316-3322
Link Here
|
3316 |
len = rpcstr_push(temp, p, sizeof(temp) - 2, STR_TERMINATE); |
3316 |
len = rpcstr_push(temp, p, sizeof(temp) - 2, STR_TERMINATE); |
3317 |
|
3317 |
|
3318 |
data->notify_data.data.length = len; |
3318 |
data->notify_data.data.length = len; |
3319 |
data->notify_data.data.string = (uint16 *)talloc(mem_ctx, len); |
3319 |
data->notify_data.data.string = (uint16 *)TALLOC(mem_ctx, len); |
3320 |
|
3320 |
|
3321 |
if (!data->notify_data.data.string) { |
3321 |
if (!data->notify_data.data.string) { |
3322 |
data->notify_data.data.length = 0; |
3322 |
data->notify_data.data.length = 0; |
Lines 3414-3420
Link Here
|
3414 |
len = sizeof(SYSTEMTIME); |
3414 |
len = sizeof(SYSTEMTIME); |
3415 |
|
3415 |
|
3416 |
data->notify_data.data.length = len; |
3416 |
data->notify_data.data.length = len; |
3417 |
data->notify_data.data.string = (uint16 *)talloc(mem_ctx, len); |
3417 |
data->notify_data.data.string = (uint16 *)TALLOC(mem_ctx, len); |
3418 |
|
3418 |
|
3419 |
if (!data->notify_data.data.string) { |
3419 |
if (!data->notify_data.data.string) { |
3420 |
data->notify_data.data.length = 0; |
3420 |
data->notify_data.data.length = 0; |
Lines 3636-3642
Link Here
|
3636 |
if (!search_notify(type, field, &j) ) |
3636 |
if (!search_notify(type, field, &j) ) |
3637 |
continue; |
3637 |
continue; |
3638 |
|
3638 |
|
3639 |
if((tid=(SPOOL_NOTIFY_INFO_DATA *)Realloc(info->data, (info->count+1)*sizeof(SPOOL_NOTIFY_INFO_DATA))) == NULL) { |
3639 |
if((tid=SMB_REALLOC_ARRAY(info->data, SPOOL_NOTIFY_INFO_DATA, info->count+1)) == NULL) { |
3640 |
DEBUG(2,("construct_notify_printer_info: failed to enlarge buffer info->data!\n")); |
3640 |
DEBUG(2,("construct_notify_printer_info: failed to enlarge buffer info->data!\n")); |
3641 |
return False; |
3641 |
return False; |
3642 |
} else |
3642 |
} else |
Lines 3692-3698
Link Here
|
3692 |
if (!search_notify(type, field, &j) ) |
3692 |
if (!search_notify(type, field, &j) ) |
3693 |
continue; |
3693 |
continue; |
3694 |
|
3694 |
|
3695 |
if((tid=Realloc(info->data, (info->count+1)*sizeof(SPOOL_NOTIFY_INFO_DATA))) == NULL) { |
3695 |
if((tid=SMB_REALLOC_ARRAY(info->data, SPOOL_NOTIFY_INFO_DATA, info->count+1)) == NULL) { |
3696 |
DEBUG(2,("construct_notify_jobs_info: failed to enlarg buffer info->data!\n")); |
3696 |
DEBUG(2,("construct_notify_jobs_info: failed to enlarg buffer info->data!\n")); |
3697 |
return False; |
3697 |
return False; |
3698 |
} |
3698 |
} |
Lines 3976-3982
Link Here
|
3976 |
|
3976 |
|
3977 |
/* it's the first time, add it to the list */ |
3977 |
/* it's the first time, add it to the list */ |
3978 |
if (session_counter==NULL) { |
3978 |
if (session_counter==NULL) { |
3979 |
if((session_counter=(counter_printer_0 *)malloc(sizeof(counter_printer_0))) == NULL) { |
3979 |
if((session_counter=SMB_MALLOC_P(counter_printer_0)) == NULL) { |
3980 |
free_a_printer(&ntprinter, 2); |
3980 |
free_a_printer(&ntprinter, 2); |
3981 |
return False; |
3981 |
return False; |
3982 |
} |
3982 |
} |
Lines 4170-4176
Link Here
|
4170 |
goto done; |
4170 |
goto done; |
4171 |
} |
4171 |
} |
4172 |
|
4172 |
|
4173 |
if ((devmode = (DEVICEMODE *)malloc(sizeof(DEVICEMODE))) == NULL) { |
4173 |
if ((devmode = SMB_MALLOC_P(DEVICEMODE)) == NULL) { |
4174 |
DEBUG(2,("construct_dev_mode: malloc fail.\n")); |
4174 |
DEBUG(2,("construct_dev_mode: malloc fail.\n")); |
4175 |
goto done; |
4175 |
goto done; |
4176 |
} |
4176 |
} |
Lines 4267-4273
Link Here
|
4267 |
return False; |
4267 |
return False; |
4268 |
|
4268 |
|
4269 |
*pp_printer = NULL; |
4269 |
*pp_printer = NULL; |
4270 |
if ((printer = (PRINTER_INFO_3 *)malloc(sizeof(PRINTER_INFO_3))) == NULL) { |
4270 |
if ((printer = SMB_MALLOC_P(PRINTER_INFO_3)) == NULL) { |
4271 |
DEBUG(2,("construct_printer_info_3: malloc fail.\n")); |
4271 |
DEBUG(2,("construct_printer_info_3: malloc fail.\n")); |
4272 |
return False; |
4272 |
return False; |
4273 |
} |
4273 |
} |
Lines 4396-4402
Link Here
|
4396 |
DEBUG(4,("Found a printer in smb.conf: %s[%x]\n", lp_servicename(snum), snum)); |
4396 |
DEBUG(4,("Found a printer in smb.conf: %s[%x]\n", lp_servicename(snum), snum)); |
4397 |
|
4397 |
|
4398 |
if (construct_printer_info_1(NULL, flags, ¤t_prt, snum)) { |
4398 |
if (construct_printer_info_1(NULL, flags, ¤t_prt, snum)) { |
4399 |
if((tp=Realloc(printers, (*returned +1)*sizeof(PRINTER_INFO_1))) == NULL) { |
4399 |
if((tp=SMB_REALLOC_ARRAY(printers, PRINTER_INFO_1, *returned +1)) == NULL) { |
4400 |
DEBUG(2,("enum_all_printers_info_1: failed to enlarge printers buffer!\n")); |
4400 |
DEBUG(2,("enum_all_printers_info_1: failed to enlarge printers buffer!\n")); |
4401 |
SAFE_FREE(printers); |
4401 |
SAFE_FREE(printers); |
4402 |
*returned=0; |
4402 |
*returned=0; |
Lines 4485-4491
Link Here
|
4485 |
* undocumented RPC call. |
4485 |
* undocumented RPC call. |
4486 |
*/ |
4486 |
*/ |
4487 |
|
4487 |
|
4488 |
if((printer=(PRINTER_INFO_1 *)malloc(sizeof(PRINTER_INFO_1))) == NULL) |
4488 |
if((printer=SMB_MALLOC_P(PRINTER_INFO_1)) == NULL) |
4489 |
return WERR_NOMEM; |
4489 |
return WERR_NOMEM; |
4490 |
|
4490 |
|
4491 |
*returned=1; |
4491 |
*returned=1; |
Lines 4569-4575
Link Here
|
4569 |
DEBUG(4,("Found a printer in smb.conf: %s[%x]\n", lp_servicename(snum), snum)); |
4569 |
DEBUG(4,("Found a printer in smb.conf: %s[%x]\n", lp_servicename(snum), snum)); |
4570 |
|
4570 |
|
4571 |
if (construct_printer_info_2(NULL, ¤t_prt, snum)) { |
4571 |
if (construct_printer_info_2(NULL, ¤t_prt, snum)) { |
4572 |
if((tp=Realloc(printers, (*returned +1)*sizeof(PRINTER_INFO_2))) == NULL) { |
4572 |
if((tp=SMB_REALLOC_ARRAY(printers, PRINTER_INFO_2, *returned +1)) == NULL) { |
4573 |
DEBUG(2,("enum_all_printers_info_2: failed to enlarge printers buffer!\n")); |
4573 |
DEBUG(2,("enum_all_printers_info_2: failed to enlarge printers buffer!\n")); |
4574 |
SAFE_FREE(printers); |
4574 |
SAFE_FREE(printers); |
4575 |
*returned = 0; |
4575 |
*returned = 0; |
Lines 4745-4751
Link Here
|
4745 |
{ |
4745 |
{ |
4746 |
PRINTER_INFO_0 *printer=NULL; |
4746 |
PRINTER_INFO_0 *printer=NULL; |
4747 |
|
4747 |
|
4748 |
if((printer=(PRINTER_INFO_0*)malloc(sizeof(PRINTER_INFO_0))) == NULL) |
4748 |
if((printer=SMB_MALLOC_P(PRINTER_INFO_0)) == NULL) |
4749 |
return WERR_NOMEM; |
4749 |
return WERR_NOMEM; |
4750 |
|
4750 |
|
4751 |
construct_printer_info_0(print_hnd, printer, snum); |
4751 |
construct_printer_info_0(print_hnd, printer, snum); |
Lines 4778-4784
Link Here
|
4778 |
{ |
4778 |
{ |
4779 |
PRINTER_INFO_1 *printer=NULL; |
4779 |
PRINTER_INFO_1 *printer=NULL; |
4780 |
|
4780 |
|
4781 |
if((printer=(PRINTER_INFO_1*)malloc(sizeof(PRINTER_INFO_1))) == NULL) |
4781 |
if((printer=SMB_MALLOC_P(PRINTER_INFO_1)) == NULL) |
4782 |
return WERR_NOMEM; |
4782 |
return WERR_NOMEM; |
4783 |
|
4783 |
|
4784 |
construct_printer_info_1(print_hnd, PRINTER_ENUM_ICON8, printer, snum); |
4784 |
construct_printer_info_1(print_hnd, PRINTER_ENUM_ICON8, printer, snum); |
Lines 4811-4817
Link Here
|
4811 |
{ |
4811 |
{ |
4812 |
PRINTER_INFO_2 *printer=NULL; |
4812 |
PRINTER_INFO_2 *printer=NULL; |
4813 |
|
4813 |
|
4814 |
if((printer=(PRINTER_INFO_2*)malloc(sizeof(PRINTER_INFO_2)))==NULL) |
4814 |
if((printer=SMB_MALLOC_P(PRINTER_INFO_2))==NULL) |
4815 |
return WERR_NOMEM; |
4815 |
return WERR_NOMEM; |
4816 |
|
4816 |
|
4817 |
construct_printer_info_2(print_hnd, printer, snum); |
4817 |
construct_printer_info_2(print_hnd, printer, snum); |
Lines 4878-4884
Link Here
|
4878 |
{ |
4878 |
{ |
4879 |
PRINTER_INFO_4 *printer=NULL; |
4879 |
PRINTER_INFO_4 *printer=NULL; |
4880 |
|
4880 |
|
4881 |
if((printer=(PRINTER_INFO_4*)malloc(sizeof(PRINTER_INFO_4)))==NULL) |
4881 |
if((printer=SMB_MALLOC_P(PRINTER_INFO_4))==NULL) |
4882 |
return WERR_NOMEM; |
4882 |
return WERR_NOMEM; |
4883 |
|
4883 |
|
4884 |
if (!construct_printer_info_4(print_hnd, printer, snum)) |
4884 |
if (!construct_printer_info_4(print_hnd, printer, snum)) |
Lines 4912-4918
Link Here
|
4912 |
{ |
4912 |
{ |
4913 |
PRINTER_INFO_5 *printer=NULL; |
4913 |
PRINTER_INFO_5 *printer=NULL; |
4914 |
|
4914 |
|
4915 |
if((printer=(PRINTER_INFO_5*)malloc(sizeof(PRINTER_INFO_5)))==NULL) |
4915 |
if((printer=SMB_MALLOC_P(PRINTER_INFO_5))==NULL) |
4916 |
return WERR_NOMEM; |
4916 |
return WERR_NOMEM; |
4917 |
|
4917 |
|
4918 |
if (!construct_printer_info_5(print_hnd, printer, snum)) |
4918 |
if (!construct_printer_info_5(print_hnd, printer, snum)) |
Lines 4943-4949
Link Here
|
4943 |
{ |
4943 |
{ |
4944 |
PRINTER_INFO_7 *printer=NULL; |
4944 |
PRINTER_INFO_7 *printer=NULL; |
4945 |
|
4945 |
|
4946 |
if((printer=(PRINTER_INFO_7*)malloc(sizeof(PRINTER_INFO_7)))==NULL) |
4946 |
if((printer=SMB_MALLOC_P(PRINTER_INFO_7))==NULL) |
4947 |
return WERR_NOMEM; |
4947 |
return WERR_NOMEM; |
4948 |
|
4948 |
|
4949 |
if (!construct_printer_info_7(print_hnd, printer, snum)) |
4949 |
if (!construct_printer_info_7(print_hnd, printer, snum)) |
Lines 5145-5151
Link Here
|
5145 |
|
5145 |
|
5146 |
/* add one extra unit16 for the second terminating NULL */ |
5146 |
/* add one extra unit16 for the second terminating NULL */ |
5147 |
|
5147 |
|
5148 |
if ( (tuary=Realloc(*uni_array, (j+1+strlen(line)+2)*sizeof(uint16))) == NULL ) { |
5148 |
if ( (tuary=SMB_REALLOC_ARRAY(*uni_array, uint16, j+1+strlen(line)+2)) == NULL ) { |
5149 |
DEBUG(2,("init_unistr_array: Realloc error\n" )); |
5149 |
DEBUG(2,("init_unistr_array: Realloc error\n" )); |
5150 |
return 0; |
5150 |
return 0; |
5151 |
} else |
5151 |
} else |
Lines 5421-5427
Link Here
|
5421 |
DRIVER_INFO_1 *info=NULL; |
5421 |
DRIVER_INFO_1 *info=NULL; |
5422 |
WERROR status; |
5422 |
WERROR status; |
5423 |
|
5423 |
|
5424 |
if((info=(DRIVER_INFO_1 *)malloc(sizeof(DRIVER_INFO_1))) == NULL) |
5424 |
if((info=SMB_MALLOC_P(DRIVER_INFO_1)) == NULL) |
5425 |
return WERR_NOMEM; |
5425 |
return WERR_NOMEM; |
5426 |
|
5426 |
|
5427 |
status=construct_printer_driver_info_1(info, snum, servername, architecture, version); |
5427 |
status=construct_printer_driver_info_1(info, snum, servername, architecture, version); |
Lines 5458-5464
Link Here
|
5458 |
DRIVER_INFO_2 *info=NULL; |
5458 |
DRIVER_INFO_2 *info=NULL; |
5459 |
WERROR status; |
5459 |
WERROR status; |
5460 |
|
5460 |
|
5461 |
if((info=(DRIVER_INFO_2 *)malloc(sizeof(DRIVER_INFO_2))) == NULL) |
5461 |
if((info=SMB_MALLOC_P(DRIVER_INFO_2)) == NULL) |
5462 |
return WERR_NOMEM; |
5462 |
return WERR_NOMEM; |
5463 |
|
5463 |
|
5464 |
status=construct_printer_driver_info_2(info, snum, servername, architecture, version); |
5464 |
status=construct_printer_driver_info_2(info, snum, servername, architecture, version); |
Lines 6444-6450
Link Here
|
6444 |
JOB_INFO_1 *info; |
6444 |
JOB_INFO_1 *info; |
6445 |
int i; |
6445 |
int i; |
6446 |
|
6446 |
|
6447 |
info=(JOB_INFO_1 *)malloc(*returned*sizeof(JOB_INFO_1)); |
6447 |
info=SMB_MALLOC_ARRAY(JOB_INFO_1,*returned); |
6448 |
if (info==NULL) { |
6448 |
if (info==NULL) { |
6449 |
SAFE_FREE(queue); |
6449 |
SAFE_FREE(queue); |
6450 |
*returned=0; |
6450 |
*returned=0; |
Lines 6494-6500
Link Here
|
6494 |
WERROR result; |
6494 |
WERROR result; |
6495 |
DEVICEMODE *devmode = NULL; |
6495 |
DEVICEMODE *devmode = NULL; |
6496 |
|
6496 |
|
6497 |
info=(JOB_INFO_2 *)malloc(*returned*sizeof(JOB_INFO_2)); |
6497 |
info=SMB_MALLOC_ARRAY(JOB_INFO_2,*returned); |
6498 |
if (info==NULL) { |
6498 |
if (info==NULL) { |
6499 |
*returned=0; |
6499 |
*returned=0; |
6500 |
result = WERR_NOMEM; |
6500 |
result = WERR_NOMEM; |
Lines 6686-6692
Link Here
|
6686 |
return WERR_NOMEM; |
6686 |
return WERR_NOMEM; |
6687 |
|
6687 |
|
6688 |
if(ndrivers != 0) { |
6688 |
if(ndrivers != 0) { |
6689 |
if((tdi1=(DRIVER_INFO_1 *)Realloc(driver_info_1, (*returned+ndrivers) * sizeof(DRIVER_INFO_1))) == NULL) { |
6689 |
if((tdi1=SMB_REALLOC_ARRAY(driver_info_1, DRIVER_INFO_1, *returned+ndrivers )) == NULL) { |
6690 |
DEBUG(0,("enumprinterdrivers_level1: failed to enlarge driver info buffer!\n")); |
6690 |
DEBUG(0,("enumprinterdrivers_level1: failed to enlarge driver info buffer!\n")); |
6691 |
SAFE_FREE(driver_info_1); |
6691 |
SAFE_FREE(driver_info_1); |
6692 |
SAFE_FREE(list); |
6692 |
SAFE_FREE(list); |
Lines 6765-6771
Link Here
|
6765 |
return WERR_NOMEM; |
6765 |
return WERR_NOMEM; |
6766 |
|
6766 |
|
6767 |
if(ndrivers != 0) { |
6767 |
if(ndrivers != 0) { |
6768 |
if((tdi2=(DRIVER_INFO_2 *)Realloc(driver_info_2, (*returned+ndrivers) * sizeof(DRIVER_INFO_2))) == NULL) { |
6768 |
if((tdi2=SMB_REALLOC_ARRAY(driver_info_2, DRIVER_INFO_2, *returned+ndrivers )) == NULL) { |
6769 |
DEBUG(0,("enumprinterdrivers_level2: failed to enlarge driver info buffer!\n")); |
6769 |
DEBUG(0,("enumprinterdrivers_level2: failed to enlarge driver info buffer!\n")); |
6770 |
SAFE_FREE(driver_info_2); |
6770 |
SAFE_FREE(driver_info_2); |
6771 |
SAFE_FREE(list); |
6771 |
SAFE_FREE(list); |
Lines 6845-6851
Link Here
|
6845 |
return WERR_NOMEM; |
6845 |
return WERR_NOMEM; |
6846 |
|
6846 |
|
6847 |
if(ndrivers != 0) { |
6847 |
if(ndrivers != 0) { |
6848 |
if((tdi3=(DRIVER_INFO_3 *)Realloc(driver_info_3, (*returned+ndrivers) * sizeof(DRIVER_INFO_3))) == NULL) { |
6848 |
if((tdi3=SMB_REALLOC_ARRAY(driver_info_3, DRIVER_INFO_3, *returned+ndrivers )) == NULL) { |
6849 |
DEBUG(0,("enumprinterdrivers_level3: failed to enlarge driver info buffer!\n")); |
6849 |
DEBUG(0,("enumprinterdrivers_level3: failed to enlarge driver info buffer!\n")); |
6850 |
SAFE_FREE(driver_info_3); |
6850 |
SAFE_FREE(driver_info_3); |
6851 |
SAFE_FREE(list); |
6851 |
SAFE_FREE(list); |
Lines 6998-7004
Link Here
|
6998 |
|
6998 |
|
6999 |
switch (level) { |
6999 |
switch (level) { |
7000 |
case 1: |
7000 |
case 1: |
7001 |
if ((forms_1=(FORM_1 *)malloc(*numofforms * sizeof(FORM_1))) == NULL) { |
7001 |
if ((forms_1=SMB_MALLOC_ARRAY(FORM_1, *numofforms)) == NULL) { |
7002 |
*numofforms=0; |
7002 |
*numofforms=0; |
7003 |
return WERR_NOMEM; |
7003 |
return WERR_NOMEM; |
7004 |
} |
7004 |
} |
Lines 7202-7208
Link Here
|
7202 |
close(fd); |
7202 |
close(fd); |
7203 |
|
7203 |
|
7204 |
if(numlines) { |
7204 |
if(numlines) { |
7205 |
if((ports=(PORT_INFO_1 *)malloc( numlines * sizeof(PORT_INFO_1) )) == NULL) { |
7205 |
if((ports=SMB_MALLOC_ARRAY( PORT_INFO_1, numlines )) == NULL) { |
7206 |
DEBUG(10,("Returning WERR_NOMEM [%s]\n", |
7206 |
DEBUG(10,("Returning WERR_NOMEM [%s]\n", |
7207 |
dos_errstr(WERR_NOMEM))); |
7207 |
dos_errstr(WERR_NOMEM))); |
7208 |
file_lines_free(qlines); |
7208 |
file_lines_free(qlines); |
Lines 7222-7228
Link Here
|
7222 |
} else { |
7222 |
} else { |
7223 |
*returned = 1; /* Sole Samba port returned. */ |
7223 |
*returned = 1; /* Sole Samba port returned. */ |
7224 |
|
7224 |
|
7225 |
if((ports=(PORT_INFO_1 *)malloc( sizeof(PORT_INFO_1) )) == NULL) |
7225 |
if((ports=SMB_MALLOC_P(PORT_INFO_1)) == NULL) |
7226 |
return WERR_NOMEM; |
7226 |
return WERR_NOMEM; |
7227 |
|
7227 |
|
7228 |
DEBUG(10,("enumports_level_1: port name %s\n", SAMBA_PRINTER_PORT_NAME)); |
7228 |
DEBUG(10,("enumports_level_1: port name %s\n", SAMBA_PRINTER_PORT_NAME)); |
Lines 7301-7307
Link Here
|
7301 |
close(fd); |
7301 |
close(fd); |
7302 |
|
7302 |
|
7303 |
if(numlines) { |
7303 |
if(numlines) { |
7304 |
if((ports=(PORT_INFO_2 *)malloc( numlines * sizeof(PORT_INFO_2) )) == NULL) { |
7304 |
if((ports=SMB_MALLOC_ARRAY( PORT_INFO_2, numlines)) == NULL) { |
7305 |
file_lines_free(qlines); |
7305 |
file_lines_free(qlines); |
7306 |
return WERR_NOMEM; |
7306 |
return WERR_NOMEM; |
7307 |
} |
7307 |
} |
Lines 7320-7326
Link Here
|
7320 |
|
7320 |
|
7321 |
*returned = 1; |
7321 |
*returned = 1; |
7322 |
|
7322 |
|
7323 |
if((ports=(PORT_INFO_2 *)malloc( sizeof(PORT_INFO_2) )) == NULL) |
7323 |
if((ports=SMB_MALLOC_P(PORT_INFO_2)) == NULL) |
7324 |
return WERR_NOMEM; |
7324 |
return WERR_NOMEM; |
7325 |
|
7325 |
|
7326 |
DEBUG(10,("enumports_level_2: port name %s\n", SAMBA_PRINTER_PORT_NAME)); |
7326 |
DEBUG(10,("enumports_level_2: port name %s\n", SAMBA_PRINTER_PORT_NAME)); |
Lines 7400-7406
Link Here
|
7400 |
int snum; |
7400 |
int snum; |
7401 |
WERROR err = WERR_OK; |
7401 |
WERROR err = WERR_OK; |
7402 |
|
7402 |
|
7403 |
if ((printer = (NT_PRINTER_INFO_LEVEL *)malloc(sizeof(NT_PRINTER_INFO_LEVEL))) == NULL) { |
7403 |
if ((printer = SMB_MALLOC_P(NT_PRINTER_INFO_LEVEL)) == NULL) { |
7404 |
DEBUG(0,("spoolss_addprinterex_level_2: malloc fail.\n")); |
7404 |
DEBUG(0,("spoolss_addprinterex_level_2: malloc fail.\n")); |
7405 |
return WERR_NOMEM; |
7405 |
return WERR_NOMEM; |
7406 |
} |
7406 |
} |
Lines 7729-7735
Link Here
|
7729 |
if (!(short_archi = get_short_archi(long_archi))) |
7729 |
if (!(short_archi = get_short_archi(long_archi))) |
7730 |
return WERR_INVALID_ENVIRONMENT; |
7730 |
return WERR_INVALID_ENVIRONMENT; |
7731 |
|
7731 |
|
7732 |
if((info=(DRIVER_DIRECTORY_1 *)malloc(sizeof(DRIVER_DIRECTORY_1))) == NULL) |
7732 |
if((info=SMB_MALLOC_P(DRIVER_DIRECTORY_1)) == NULL) |
7733 |
return WERR_NOMEM; |
7733 |
return WERR_NOMEM; |
7734 |
|
7734 |
|
7735 |
slprintf(path, sizeof(path)-1, "\\\\%s\\print$\\%s", pservername, short_archi); |
7735 |
slprintf(path, sizeof(path)-1, "\\\\%s\\print$\\%s", pservername, short_archi); |
Lines 7897-7903
Link Here
|
7897 |
|
7897 |
|
7898 |
*out_max_value_len=(in_value_len/sizeof(uint16)); |
7898 |
*out_max_value_len=(in_value_len/sizeof(uint16)); |
7899 |
|
7899 |
|
7900 |
if((*out_value=(uint16 *)talloc_zero(p->mem_ctx, in_value_len*sizeof(uint8))) == NULL) |
7900 |
if((*out_value=(uint16 *)TALLOC_ZERO(p->mem_ctx, in_value_len*sizeof(uint8))) == NULL) |
7901 |
{ |
7901 |
{ |
7902 |
result = WERR_NOMEM; |
7902 |
result = WERR_NOMEM; |
7903 |
goto done; |
7903 |
goto done; |
Lines 7912-7918
Link Here
|
7912 |
|
7912 |
|
7913 |
/* only allocate when given a non-zero data_len */ |
7913 |
/* only allocate when given a non-zero data_len */ |
7914 |
|
7914 |
|
7915 |
if ( in_data_len && ((*data_out=(uint8 *)talloc_zero(p->mem_ctx, in_data_len*sizeof(uint8))) == NULL) ) |
7915 |
if ( in_data_len && ((*data_out=(uint8 *)TALLOC_ZERO(p->mem_ctx, in_data_len*sizeof(uint8))) == NULL) ) |
7916 |
{ |
7916 |
{ |
7917 |
result = WERR_NOMEM; |
7917 |
result = WERR_NOMEM; |
7918 |
goto done; |
7918 |
goto done; |
Lines 7933-7939
Link Here
|
7933 |
|
7933 |
|
7934 |
/* name */ |
7934 |
/* name */ |
7935 |
*out_max_value_len=(in_value_len/sizeof(uint16)); |
7935 |
*out_max_value_len=(in_value_len/sizeof(uint16)); |
7936 |
if ( (*out_value = (uint16 *)talloc_zero(p->mem_ctx, in_value_len*sizeof(uint8))) == NULL ) |
7936 |
if ( (*out_value = (uint16 *)TALLOC_ZERO(p->mem_ctx, in_value_len*sizeof(uint8))) == NULL ) |
7937 |
{ |
7937 |
{ |
7938 |
result = WERR_NOMEM; |
7938 |
result = WERR_NOMEM; |
7939 |
goto done; |
7939 |
goto done; |
Lines 7948-7954
Link Here
|
7948 |
/* data - counted in bytes */ |
7948 |
/* data - counted in bytes */ |
7949 |
|
7949 |
|
7950 |
*out_max_data_len = in_data_len; |
7950 |
*out_max_data_len = in_data_len; |
7951 |
if ( (*data_out = (uint8 *)talloc_zero(p->mem_ctx, in_data_len*sizeof(uint8))) == NULL) |
7951 |
if ( (*data_out = (uint8 *)TALLOC_ZERO(p->mem_ctx, in_data_len*sizeof(uint8))) == NULL) |
7952 |
{ |
7952 |
{ |
7953 |
result = WERR_NOMEM; |
7953 |
result = WERR_NOMEM; |
7954 |
goto done; |
7954 |
goto done; |
Lines 8333-8339
Link Here
|
8333 |
{ |
8333 |
{ |
8334 |
PRINTPROCESSOR_1 *info_1=NULL; |
8334 |
PRINTPROCESSOR_1 *info_1=NULL; |
8335 |
|
8335 |
|
8336 |
if((info_1 = (PRINTPROCESSOR_1 *)malloc(sizeof(PRINTPROCESSOR_1))) == NULL) |
8336 |
if((info_1 = SMB_MALLOC_P(PRINTPROCESSOR_1)) == NULL) |
8337 |
return WERR_NOMEM; |
8337 |
return WERR_NOMEM; |
8338 |
|
8338 |
|
8339 |
(*returned) = 0x1; |
8339 |
(*returned) = 0x1; |
Lines 8400-8406
Link Here
|
8400 |
{ |
8400 |
{ |
8401 |
PRINTPROCDATATYPE_1 *info_1=NULL; |
8401 |
PRINTPROCDATATYPE_1 *info_1=NULL; |
8402 |
|
8402 |
|
8403 |
if((info_1 = (PRINTPROCDATATYPE_1 *)malloc(sizeof(PRINTPROCDATATYPE_1))) == NULL) |
8403 |
if((info_1 = SMB_MALLOC_P(PRINTPROCDATATYPE_1)) == NULL) |
8404 |
return WERR_NOMEM; |
8404 |
return WERR_NOMEM; |
8405 |
|
8405 |
|
8406 |
(*returned) = 0x1; |
8406 |
(*returned) = 0x1; |
Lines 8460-8466
Link Here
|
8460 |
{ |
8460 |
{ |
8461 |
PRINTMONITOR_1 *info_1=NULL; |
8461 |
PRINTMONITOR_1 *info_1=NULL; |
8462 |
|
8462 |
|
8463 |
if((info_1 = (PRINTMONITOR_1 *)malloc(sizeof(PRINTMONITOR_1))) == NULL) |
8463 |
if((info_1 = SMB_MALLOC_P(PRINTMONITOR_1)) == NULL) |
8464 |
return WERR_NOMEM; |
8464 |
return WERR_NOMEM; |
8465 |
|
8465 |
|
8466 |
(*returned) = 0x1; |
8466 |
(*returned) = 0x1; |
Lines 8492-8498
Link Here
|
8492 |
{ |
8492 |
{ |
8493 |
PRINTMONITOR_2 *info_2=NULL; |
8493 |
PRINTMONITOR_2 *info_2=NULL; |
8494 |
|
8494 |
|
8495 |
if((info_2 = (PRINTMONITOR_2 *)malloc(sizeof(PRINTMONITOR_2))) == NULL) |
8495 |
if((info_2 = SMB_MALLOC_P(PRINTMONITOR_2)) == NULL) |
8496 |
return WERR_NOMEM; |
8496 |
return WERR_NOMEM; |
8497 |
|
8497 |
|
8498 |
(*returned) = 0x1; |
8498 |
(*returned) = 0x1; |
Lines 8567-8573
Link Here
|
8567 |
BOOL found=False; |
8567 |
BOOL found=False; |
8568 |
JOB_INFO_1 *info_1=NULL; |
8568 |
JOB_INFO_1 *info_1=NULL; |
8569 |
|
8569 |
|
8570 |
info_1=(JOB_INFO_1 *)malloc(sizeof(JOB_INFO_1)); |
8570 |
info_1=SMB_MALLOC_P(JOB_INFO_1); |
8571 |
|
8571 |
|
8572 |
if (info_1 == NULL) { |
8572 |
if (info_1 == NULL) { |
8573 |
return WERR_NOMEM; |
8573 |
return WERR_NOMEM; |
Lines 8618-8624
Link Here
|
8618 |
DEVICEMODE *devmode = NULL; |
8618 |
DEVICEMODE *devmode = NULL; |
8619 |
NT_DEVICEMODE *nt_devmode = NULL; |
8619 |
NT_DEVICEMODE *nt_devmode = NULL; |
8620 |
|
8620 |
|
8621 |
info_2=(JOB_INFO_2 *)malloc(sizeof(JOB_INFO_2)); |
8621 |
info_2=SMB_MALLOC_P(JOB_INFO_2); |
8622 |
|
8622 |
|
8623 |
ZERO_STRUCTP(info_2); |
8623 |
ZERO_STRUCTP(info_2); |
8624 |
|
8624 |
|
Lines 8650-8656
Link Here
|
8650 |
if ( !(nt_devmode=print_job_devmode( lp_const_servicename(snum), jobid )) ) |
8650 |
if ( !(nt_devmode=print_job_devmode( lp_const_servicename(snum), jobid )) ) |
8651 |
devmode = construct_dev_mode(snum); |
8651 |
devmode = construct_dev_mode(snum); |
8652 |
else { |
8652 |
else { |
8653 |
if ((devmode = (DEVICEMODE *)malloc(sizeof(DEVICEMODE))) != NULL) { |
8653 |
if ((devmode = SMB_MALLOC_P(DEVICEMODE)) != NULL) { |
8654 |
ZERO_STRUCTP( devmode ); |
8654 |
ZERO_STRUCTP( devmode ); |
8655 |
convert_nt_devicemode( devmode, nt_devmode ); |
8655 |
convert_nt_devicemode( devmode, nt_devmode ); |
8656 |
} |
8656 |
} |
Lines 8828-8834
Link Here
|
8828 |
|
8828 |
|
8829 |
if ( *out_size ) |
8829 |
if ( *out_size ) |
8830 |
{ |
8830 |
{ |
8831 |
if( (*data=(uint8 *)talloc_zero(p->mem_ctx, *out_size*sizeof(uint8))) == NULL ) { |
8831 |
if( (*data=(uint8 *)TALLOC_ZERO(p->mem_ctx, *out_size*sizeof(uint8))) == NULL ) { |
8832 |
status = WERR_NOMEM; |
8832 |
status = WERR_NOMEM; |
8833 |
goto done; |
8833 |
goto done; |
8834 |
} |
8834 |
} |
Lines 9187-9193
Link Here
|
9187 |
num_entries = regval_ctr_numvals( &p_data->keys[key_index].values ); |
9187 |
num_entries = regval_ctr_numvals( &p_data->keys[key_index].values ); |
9188 |
if ( num_entries ) |
9188 |
if ( num_entries ) |
9189 |
{ |
9189 |
{ |
9190 |
if ( (enum_values=talloc(p->mem_ctx, num_entries*sizeof(PRINTER_ENUM_VALUES))) == NULL ) |
9190 |
if ( (enum_values=TALLOC_ARRAY(p->mem_ctx, PRINTER_ENUM_VALUES, num_entries)) == NULL ) |
9191 |
{ |
9191 |
{ |
9192 |
DEBUG(0,("_spoolss_enumprinterdataex: talloc() failed to allocate memory for [%lu] bytes!\n", |
9192 |
DEBUG(0,("_spoolss_enumprinterdataex: talloc() failed to allocate memory for [%lu] bytes!\n", |
9193 |
(unsigned long)num_entries*sizeof(PRINTER_ENUM_VALUES))); |
9193 |
(unsigned long)num_entries*sizeof(PRINTER_ENUM_VALUES))); |
Lines 9219-9225
Link Here
|
9219 |
|
9219 |
|
9220 |
data_len = regval_size( val ); |
9220 |
data_len = regval_size( val ); |
9221 |
if ( data_len ) { |
9221 |
if ( data_len ) { |
9222 |
if ( !(enum_values[i].data = talloc_memdup(p->mem_ctx, regval_data_p(val), data_len)) ) |
9222 |
if ( !(enum_values[i].data = TALLOC_MEMDUP(p->mem_ctx, regval_data_p(val), data_len)) ) |
9223 |
{ |
9223 |
{ |
9224 |
DEBUG(0,("talloc_memdup failed to allocate memory [data_len=%d] for data!\n", |
9224 |
DEBUG(0,("talloc_memdup failed to allocate memory [data_len=%d] for data!\n", |
9225 |
data_len )); |
9225 |
data_len )); |
Lines 9282-9288
Link Here
|
9282 |
if (!get_short_archi(long_archi)) |
9282 |
if (!get_short_archi(long_archi)) |
9283 |
return WERR_INVALID_ENVIRONMENT; |
9283 |
return WERR_INVALID_ENVIRONMENT; |
9284 |
|
9284 |
|
9285 |
if((info=(PRINTPROCESSOR_DIRECTORY_1 *)malloc(sizeof(PRINTPROCESSOR_DIRECTORY_1))) == NULL) |
9285 |
if((info=SMB_MALLOC_P(PRINTPROCESSOR_DIRECTORY_1)) == NULL) |
9286 |
return WERR_NOMEM; |
9286 |
return WERR_NOMEM; |
9287 |
|
9287 |
|
9288 |
pstrcpy(path, "C:\\WINNT\\System32\\spool\\PRTPROCS\\W32X86"); |
9288 |
pstrcpy(path, "C:\\WINNT\\System32\\spool\\PRTPROCS\\W32X86"); |