krb5 commit [krb5-1.11]: Fix various result checks

Tom Yu tlyu at MIT.EDU
Thu Jan 31 16:16:21 EST 2013


https://github.com/krb5/krb5/commit/9f99ee4de35c9dc78f4c4c418293610a5263e69b
commit 9f99ee4de35c9dc78f4c4c418293610a5263e69b
Author: Nickolai Zeldovich <nickolai at csail.mit.edu>
Date:   Mon Jan 7 01:37:19 2013 -0500

    Fix various result checks
    
    Correct three cases where the wrong expression was checked to see if
    an allocation function returned null.
    
    [ghudson at mit.edu: commit message, patch splitting]
    
    (cherry picked from commit a9ee4a040eeacab1d410ff9e4c862484b531c401)
    
    ticket: 7534
    version_fixed: 1.11.1
    status: resolved

 src/lib/kadm5/srv/svr_principal.c                  |    2 +-
 src/plugins/kdb/db2/libdb2/hash/hash_bigkey.c      |    2 +-
 src/plugins/preauth/pkinit/pkinit_crypto_openssl.c |    2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/lib/kadm5/srv/svr_principal.c b/src/lib/kadm5/srv/svr_principal.c
index 5d85827..ae36841 100644
--- a/src/lib/kadm5/srv/svr_principal.c
+++ b/src/lib/kadm5/srv/svr_principal.c
@@ -1991,7 +1991,7 @@ make_ks_from_keys(krb5_context context, int n_keys, krb5_keyblock *keyblocks,
     int i;
 
     *ks_tuple = calloc(n_keys, sizeof(**ks_tuple));
-    if (ks_tuple == NULL)
+    if (*ks_tuple == NULL)
         return ENOMEM;
 
     for (i = 0; i < n_keys; i++) {
diff --git a/src/plugins/kdb/db2/libdb2/hash/hash_bigkey.c b/src/plugins/kdb/db2/libdb2/hash/hash_bigkey.c
index e6aa035..497939d 100644
--- a/src/plugins/kdb/db2/libdb2/hash/hash_bigkey.c
+++ b/src/plugins/kdb/db2/libdb2/hash/hash_bigkey.c
@@ -303,7 +303,7 @@ __get_bigkey(hashp, pagep, ndx, key)
 
 	key_pagep =
 	    __get_page(hashp, OADDR_TO_PAGE(DATA_OFF(pagep, ndx)), A_RAW);
-	if (!pagep)
+	if (!key_pagep)
 		return (-1);
 	key->size = collect_key(hashp, key_pagep, 0, NULL);
 	key->data = hashp->bigkey_buf;
diff --git a/src/plugins/preauth/pkinit/pkinit_crypto_openssl.c b/src/plugins/preauth/pkinit/pkinit_crypto_openssl.c
index dfb45c1..17c37c6 100644
--- a/src/plugins/preauth/pkinit/pkinit_crypto_openssl.c
+++ b/src/plugins/preauth/pkinit/pkinit_crypto_openssl.c
@@ -3619,7 +3619,7 @@ prepare_enc_data(unsigned char *indata,
     asn1_const_Finish(&c);
 
     *outdata = malloc((size_t)Tlen);
-    if (outdata == NULL) {
+    if (*outdata == NULL) {
         retval = ENOMEM;
         goto cleanup;
     }


More information about the cvs-krb5 mailing list