cipher: Improve error handling.
authorJustus Winter <justus@g10code.com>
Mon, 7 Dec 2015 11:44:48 +0000 (12:44 +0100)
committerJustus Winter <justus@g10code.com>
Mon, 7 Dec 2015 11:44:48 +0000 (12:44 +0100)
* cipher/ecc.c (ecc_decrypt_raw): Improve error handling.
--
Found using the Clang Static Analyzer.

Signed-off-by: Justus Winter <justus@g10code.com>
cipher/ecc.c

index e4e9139..105650e 100644 (file)
@@ -1591,7 +1591,10 @@ ecc_decrypt_raw (gcry_sexp_t *r_plain, gcry_sexp_t s_data, gcry_sexp_t keyparms)
         rawmpi = _gcry_mpi_get_buffer_extra (x, ec->nbits/8, -1,
                                              &rawmpilen, NULL);
         if (!rawmpi)
-          rc = gpg_err_code_from_syserror ();
+          {
+            rc = gpg_err_code_from_syserror ();
+            goto leave;
+          }
         else
           {
             rawmpi[0] = 0x40;