Author: lha
Date: 2006-10-07 09:17:24 +0000 (Sat, 07 Oct 2006)
New Revision: 569

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=lorikeet&rev=569

Log:
merge build fixes from heimdal cvs 20061007
Modified:
   trunk/heimdal/lib/hx509/ks_file.c


Changeset:
Modified: trunk/heimdal/lib/hx509/ks_file.c
===================================================================
--- trunk/heimdal/lib/hx509/ks_file.c   2006-10-07 08:24:40 UTC (rev 568)
+++ trunk/heimdal/lib/hx509/ks_file.c   2006-10-07 09:17:24 UTC (rev 569)
@@ -32,7 +32,7 @@
  */
 
 #include "hx_locl.h"
-RCSID("$Id: ks_file.c,v 1.21 2006/09/07 10:58:17 lha Exp $");
+RCSID("$Id: ks_file.c,v 1.23 2006/10/06 13:16:07 lha Exp $");
 
 struct ks_file {
     hx509_certs certs;
@@ -198,28 +198,30 @@
 
        cipher = EVP_get_cipherbyname(type);
        if (cipher == NULL) {
-           free(type);
            free(ivdata);
            hx509_set_error_string(context, 0, EINVAL,
                                   "RSA key encrypted with "
                                   "unsupported cipher: %s",
                                   type);
+           free(type);
            return EINVAL;
        }
 
 #define PKCS5_SALT_LEN 8
 
        ssize = hex_decode(iv, ivdata, size);
+       free(type);
+       type = NULL;
+       iv = NULL;
+
        if (ssize < 0 || ssize < PKCS5_SALT_LEN || ssize < 
EVP_CIPHER_iv_length(cipher)) {
            free(ivdata);
-           free(type);
            hx509_clear_error_string(context);
            return EINVAL;
        }
        
        key = malloc(EVP_CIPHER_key_length(cipher));
        if (key == NULL) {
-           free(type);
            free(ivdata);
            hx509_clear_error_string(context);
            return ENOMEM;
@@ -228,7 +230,6 @@
        ret = EVP_BytesToKey(cipher, EVP_md5(), ivdata,
                             password, passwordlen,
                             1, key, NULL);
-       free(type);
        if (ret <= 0) {
            free(key);
            free(ivdata);

Reply via email to