tools: Fix use of uninitialized var in mime-maker.
authorWerner Koch <wk@gnupg.org>
Thu, 8 Dec 2016 12:04:06 +0000 (13:04 +0100)
committerWerner Koch <wk@gnupg.org>
Thu, 8 Dec 2016 12:08:02 +0000 (13:08 +0100)
* tools/mime-maker.c (ensure_part): Make sure to set R_PARENT on
error.
(add_missing_headers): Ensure that ERR is set on success.

* tools/wks-util.c (wks_parse_policy): Fix indentation.

Signed-off-by: Werner Koch <wk@gnupg.org>
tools/mime-maker.c
tools/wks-util.c

index ca05f1d..2e32069 100644 (file)
@@ -251,7 +251,11 @@ ensure_part (mime_maker_t ctx, part_t *r_parent)
     {
       ctx->mail = xtrycalloc (1, sizeof *ctx->mail);
       if (!ctx->mail)
-        return gpg_error_from_syserror ();
+        {
+          if (r_parent)
+            *r_parent = NULL;
+          return gpg_error_from_syserror ();
+        }
       log_assert (!ctx->current_part);
       ctx->current_part = ctx->mail;
       ctx->current_part->headers_tail = &ctx->current_part->headers;
@@ -722,6 +726,7 @@ add_missing_headers (mime_maker_t ctx)
         goto leave;
     }
 
+  err = 0;
 
  leave:
   return err;
index 183bdcd..1b47612 100644 (file)
@@ -164,7 +164,8 @@ wks_parse_policy (policy_flags_t flags, estream_t stream, int ignore_unknown)
 
   if (!err && !es_feof (stream))
     err = gpg_error_from_syserror ();
-    leave:
+
+ leave:
   if (err)
     log_error ("error reading '%s', line %d: %s\n",
                es_fname_get (stream), lnr, gpg_strerror (err));