mirror of
git://git.gnupg.org/gnupg.git
synced 2025-01-18 14:17:03 +01:00
common: Fix memory leak.
* common/iobuf.c (iobuf_set_partial_body_length_mode): Only create context if necessary. Signed-off-by: Justus Winter <justus@g10code.com>
This commit is contained in:
parent
9037c23979
commit
d2d19063d3
@ -2530,9 +2530,6 @@ iobuf_get_fname_nonnull (iobuf_t a)
|
|||||||
void
|
void
|
||||||
iobuf_set_partial_body_length_mode (iobuf_t a, size_t len)
|
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)
|
if (!len)
|
||||||
/* Disable partial body length mode. */
|
/* Disable partial body length mode. */
|
||||||
{
|
{
|
||||||
@ -2546,6 +2543,8 @@ iobuf_set_partial_body_length_mode (iobuf_t a, size_t len)
|
|||||||
else
|
else
|
||||||
/* Enabled partial body length mode. */
|
/* Enabled partial body length mode. */
|
||||||
{
|
{
|
||||||
|
block_filter_ctx_t *ctx = xcalloc (1, sizeof *ctx);
|
||||||
|
ctx->use = a->use;
|
||||||
ctx->partial = 1;
|
ctx->partial = 1;
|
||||||
ctx->size = 0;
|
ctx->size = 0;
|
||||||
ctx->first_c = len;
|
ctx->first_c = len;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user