g13: Avoid segv after pipe creation failure.
authorWerner Koch <wk@gnupg.org>
Thu, 18 Sep 2014 14:00:34 +0000 (16:00 +0200)
committerWerner Koch <wk@gnupg.org>
Thu, 18 Sep 2014 14:01:05 +0000 (16:01 +0200)
* g13/call-gpg.c (gpg_encrypt_blob): Init some vars in case of an
early error.
(gpg_decrypt_blob): Ditto.

g13/call-gpg.c

index 316082a..54f6056 100644 (file)
@@ -332,11 +332,11 @@ gpg_encrypt_blob (ctrl_t ctrl, const void *plain, size_t plainlen,
                   strlist_t keys, void **r_ciph, size_t *r_ciphlen)
 {
   gpg_error_t err;
-  assuan_context_t ctx;
+  assuan_context_t ctx = NULL;
   int outbound_fds[2] = { -1, -1 };
   int inbound_fds[2]  = { -1, -1 };
-  npth_t writer_thread;
-  npth_t reader_thread;
+  npth_t writer_thread = (npth_t)0;
+  npth_t reader_thread = (npth_t)0;
   gpg_error_t writer_err, reader_err;
   membuf_t reader_mb;
   char line[ASSUAN_LINELENGTH];
@@ -475,11 +475,11 @@ gpg_decrypt_blob (ctrl_t ctrl, const void *ciph, size_t ciphlen,
                   void **r_plain, size_t *r_plainlen)
 {
   gpg_error_t err;
-  assuan_context_t ctx;
+  assuan_context_t ctx = NULL;
   int outbound_fds[2] = { -1, -1 };
   int inbound_fds[2]  = { -1, -1 };
-  npth_t writer_thread;
-  npth_t reader_thread;
+  npth_t writer_thread = (npth_t)0;
+  npth_t reader_thread = (npth_t)0;
   gpg_error_t writer_err, reader_err;
   membuf_t reader_mb;
   int ret;