[Pkg-gnupg-commit] [gnupg2] 82/160: common: Fix memory leak.

Daniel Kahn Gillmor dkg at fifthhorseman.net
Fri Jul 15 09:36:38 UTC 2016


This is an automated email from the git hooks/post-receive script.

dkg pushed a commit to branch upstream
in repository gnupg2.

commit d2d19063d3adf29340aeb39f14e1b1e9aacf41e7
Author: Justus Winter <justus at g10code.com>
Date:   Thu Jun 30 17:29:19 2016 +0200

    common: Fix memory leak.
    
    * common/iobuf.c (iobuf_set_partial_body_length_mode): Only create
    context if necessary.
    
    Signed-off-by: Justus Winter <justus at g10code.com>
---
 common/iobuf.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/common/iobuf.c b/common/iobuf.c
index c8ec00f..f3d67b4 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;

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-gnupg/gnupg2.git



More information about the Pkg-gnupg-commit mailing list