From bdc6c43693858a47faf32d1d09a37e659346c0b0 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Tue, 9 Sep 2008 17:50:30 +0200 Subject: [PATCH] libcli/raw: give the caller the chance to prevent the talloc_free(req) in the _recv functions metze --- source/libcli/raw/libcliraw.h | 3 +++ source/libcli/raw/rawrequest.c | 6 +++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/source/libcli/raw/libcliraw.h b/source/libcli/raw/libcliraw.h index d55b4cc42c16..c9cafedd4c91 100644 --- a/source/libcli/raw/libcliraw.h +++ b/source/libcli/raw/libcliraw.h @@ -261,6 +261,9 @@ struct smbcli_request { counter by one */ uint_t sign_single_increment:1; + /* give the caller a chance to prevent the talloc_free() in the _recv() function */ + bool do_not_free; + /* the mid of this packet - used to match replies */ uint16_t mid; diff --git a/source/libcli/raw/rawrequest.c b/source/libcli/raw/rawrequest.c index a0e6452748e0..dd9b1f3e963c 100644 --- a/source/libcli/raw/rawrequest.c +++ b/source/libcli/raw/rawrequest.c @@ -72,7 +72,11 @@ _PUBLIC_ NTSTATUS smbcli_request_destroy(struct smbcli_request *req) } status = req->status; - talloc_free(req); + + if (!req->do_not_free) { + talloc_free(req); + } + return status; } -- 2.34.1