r21698: Check for talloc failures.
authorAndrew Bartlett <abartlet@samba.org>
Mon, 5 Mar 2007 10:28:24 +0000 (10:28 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 19:49:14 +0000 (14:49 -0500)
Andrew Bartlett
(This used to be commit c9eb5bf19a702af32a4e4f109a27e4076303efdc)

source4/rpc_server/echo/rpc_echo.c

index 7be464935beee3de8e95a697f3e7756d0a77161a..8f562b482621f03e243eb07957489fca7ad63a3a 100644 (file)
@@ -58,6 +58,9 @@ static NTSTATUS dcesrv_echo_SourceData(struct dcesrv_call_state *dce_call, TALLO
        int i;
 
        r->out.data = talloc_array(mem_ctx, uint8_t, r->in.len);
+       if (!r->out.data) {
+               return NT_STATUS_NO_MEMORY;
+       }
        
        for (i=0;i<r->in.len;i++) {
                r->out.data[i] = i;
@@ -126,6 +129,9 @@ static NTSTATUS dcesrv_echo_TestSurrounding(struct dcesrv_call_state *dce_call,
        }
 
        r->out.data = talloc(mem_ctx, struct echo_Surrounding);
+       if (!r->out.data) {
+               return NT_STATUS_NO_MEMORY;
+       }
        r->out.data->x = 2 * r->in.data->x;
        r->out.data->surrounding = talloc_zero_array(mem_ctx, uint16_t, r->out.data->x);