summaryrefslogtreecommitdiff
path: root/source4/libcli
diff options
context:
space:
mode:
Diffstat (limited to 'source4/libcli')
-rw-r--r--source4/libcli/raw/clitransport.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/source4/libcli/raw/clitransport.c b/source4/libcli/raw/clitransport.c
index bc00b19ef5..6bf79ecfb0 100644
--- a/source4/libcli/raw/clitransport.c
+++ b/source4/libcli/raw/clitransport.c
@@ -559,7 +559,16 @@ void smbcli_transport_send(struct smbcli_request *req)
return;
}
- /* put it on the socket queue */
+ /* put it on the socket queue
+ * - as the buffer is a part of the smbcli_request struct
+ * we need to reference it here, because packet_queue_run()
+ * will call talloc_free() on it
+ */
+ if (!talloc_reference(req, req->out.buffer)) {
+ req->state = SMBCLI_REQUEST_ERROR;
+ req->status = NT_STATUS_NO_MEMORY;
+ return;
+ }
blob = data_blob_const(req->out.buffer, req->out.size);
status = packet_send(req->transport->packet, blob);
if (!NT_STATUS_IS_OK(status)) {