diff options
author | Justus Winter <[email protected]> | 2016-06-30 15:29:19 +0000 |
---|---|---|
committer | Justus Winter <[email protected]> | 2016-06-30 16:50:16 +0000 |
commit | d2d19063d3adf29340aeb39f14e1b1e9aacf41e7 (patch) | |
tree | 5c542c2df825f195b6de6521f10933742a764eb2 /common/iobuf.c | |
parent | common: Fix memory leak. (diff) | |
download | gnupg-d2d19063d3adf29340aeb39f14e1b1e9aacf41e7.tar.gz gnupg-d2d19063d3adf29340aeb39f14e1b1e9aacf41e7.zip |
common: Fix memory leak.
* common/iobuf.c (iobuf_set_partial_body_length_mode): Only create
context if necessary.
Signed-off-by: Justus Winter <[email protected]>
Diffstat (limited to 'common/iobuf.c')
-rw-r--r-- | common/iobuf.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/common/iobuf.c b/common/iobuf.c index c8ec00f7f..f3d67b474 100644 --- a/common/iobuf.c +++ b/common/iobuf.c @@ -2530,9 +2530,6 @@ iobuf_get_fname_nonnull (iobuf_t a) void iobuf_set_partial_body_length_mode (iobuf_t a, size_t len) { - block_filter_ctx_t *ctx = xcalloc (1, sizeof *ctx); - - ctx->use = a->use; if (!len) /* Disable partial body length mode. */ { @@ -2546,6 +2543,8 @@ iobuf_set_partial_body_length_mode (iobuf_t a, size_t len) else /* Enabled partial body length mode. */ { + block_filter_ctx_t *ctx = xcalloc (1, sizeof *ctx); + ctx->use = a->use; ctx->partial = 1; ctx->size = 0; ctx->first_c = len; |