r11642: add some error checks
authorStefan Metzmacher <metze@samba.org>
Thu, 10 Nov 2005 13:52:07 +0000 (13:52 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 18:46:05 +0000 (13:46 -0500)
metze
(This used to be commit 9d6406d8daeff0a9bde72ce7749d18fa61324e8a)

source4/lib/stream/packet.c

index a272b28c0c40b263f91be70b940547f1d31091a2..14933ff963c07c7f12ebc74a20c91589e3fe6e7b 100644 (file)
@@ -317,7 +317,11 @@ next_partial:
                        packet_error(pc, NT_STATUS_NO_MEMORY);
                        return;
                }
-               data_blob_realloc(pc, &blob, pc->packet_size);
+               status = data_blob_realloc(pc, &blob, pc->packet_size);
+               if (!NT_STATUS_IS_OK(status)) {
+                       packet_error(pc, status);
+                       return;
+               }
        } else {
                pc->partial = data_blob(NULL, 0);
        }
@@ -440,7 +444,9 @@ NTSTATUS packet_send(struct packet_context *pc, DATA_BLOB blob)
        /* if we aren't going to free the packet then we must reference it
           to ensure it doesn't disappear before going out */
        if (pc->nofree) {
-               talloc_reference(el, blob.data);
+               if (!talloc_reference(el, blob.data)) {
+                       return NT_STATUS_NO_MEMORY;
+               }
        } else {
                talloc_steal(el, blob.data);
        }