svn commit: samba r23249 - in branches/SAMBA_3_0/source/rpcclient: .
jerry at samba.org
jerry at samba.org
Wed May 30 21:46:04 GMT 2007
Author: jerry
Date: 2007-05-30 21:46:03 +0000 (Wed, 30 May 2007)
New Revision: 23249
WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=23249
Log:
another sync from 3.0.26 for the echo work to rpcclient
Modified:
branches/SAMBA_3_0/source/rpcclient/cmd_echo.c
Changeset:
Modified: branches/SAMBA_3_0/source/rpcclient/cmd_echo.c
===================================================================
--- branches/SAMBA_3_0/source/rpcclient/cmd_echo.c 2007-05-30 21:43:48 UTC (rev 23248)
+++ branches/SAMBA_3_0/source/rpcclient/cmd_echo.c 2007-05-30 21:46:03 UTC (rev 23249)
@@ -52,7 +52,7 @@
{
uint32 size, i;
NTSTATUS result;
- uint8 *in_data = NULL, *out_data = NULL;
+ uint8_t *in_data = NULL, *out_data = NULL;
if (argc != 2) {
printf("Usage: %s num\n", argv[0]);
@@ -60,8 +60,16 @@
}
size = atoi(argv[1]);
- in_data = (uint8 *)SMB_MALLOC(size);
- out_data = (uint8 *)SMB_MALLOC(size);
+ if ( (in_data = (uint8_t*)SMB_MALLOC(size)) == NULL ) {
+ printf("Failure to allocate buff of %d bytes\n",
+ size);
+ goto done;
+ }
+ if ( (out_data = (uint8_t*)SMB_MALLOC(size)) == NULL ) {
+ printf("Failure to allocate buff of %d bytes\n",
+ size);
+ goto done;
+ }
for (i = 0; i < size; i++)
in_data[i] = i & 0xff;
@@ -81,7 +89,7 @@
done:
SAFE_FREE(in_data);
- TALLOC_FREE(out_data);
+ SAFE_FREE(out_data);
return result;
}
@@ -92,7 +100,7 @@
{
uint32 size, i;
NTSTATUS result;
- uint8 *out_data;
+ uint8_t *out_data = NULL;
if (argc != 2) {
printf("Usage: %s num\n", argv[0]);
@@ -100,15 +108,20 @@
}
size = atoi(argv[1]);
+ if ( (out_data = (uint8_t*)SMB_MALLOC(size)) == NULL ) {
+ printf("Failure to allocate buff of %d bytes\n",
+ size);
+ goto done;
+ }
+
- out_data = SMB_MALLOC_ARRAY(uint8, size);
result = rpccli_echo_SourceData(cli, mem_ctx, size, out_data);
if (!NT_STATUS_IS_OK(result))
goto done;
for (i = 0; i < size; i++) {
- if (out_data[i] != (i & 0xff)) {
+ if (out_data && out_data[i] != (i & 0xff)) {
printf("mismatch at offset %d, %d != %d\n",
i, out_data[i], i & 0xff);
result = NT_STATUS_UNSUCCESSFUL;
@@ -116,8 +129,6 @@
}
done:
- TALLOC_FREE(out_data);
-
return result;
}
@@ -126,7 +137,7 @@
{
uint32 size, i;
NTSTATUS result;
- uint8 *in_data = NULL;
+ uint8_t *in_data = NULL;
if (argc != 2) {
printf("Usage: %s num\n", argv[0]);
@@ -134,7 +145,11 @@
}
size = atoi(argv[1]);
- in_data = (uint8 *)SMB_MALLOC(size);
+ if ( (in_data = (uint8_t*)SMB_MALLOC(size)) == NULL ) {
+ printf("Failure to allocate buff of %d bytes\n",
+ size);
+ goto done;
+ }
for (i = 0; i < size; i++)
in_data[i] = i & 0xff;
More information about the samba-cvs
mailing list