Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/crypto/dist/heimdal/lib/krb5 remove a (potentially) double free



details:   https://anonhg.NetBSD.org/src/rev/d1a1b426c338
branches:  trunk
changeset: 512896:d1a1b426c338
user:      assar <assar%NetBSD.org@localhost>
date:      Wed Jul 18 21:54:56 2001 +0000

description:
remove a (potentially) double free

diffstat:

 crypto/dist/heimdal/lib/krb5/keytab_any.c |  17 ++++++++---------
 1 files changed, 8 insertions(+), 9 deletions(-)

diffs (54 lines):

diff -r 399236a67fee -r d1a1b426c338 crypto/dist/heimdal/lib/krb5/keytab_any.c
--- a/crypto/dist/heimdal/lib/krb5/keytab_any.c Wed Jul 18 20:52:47 2001 +0000
+++ b/crypto/dist/heimdal/lib/krb5/keytab_any.c Wed Jul 18 21:54:56 2001 +0000
@@ -33,7 +33,7 @@
 
 #include "krb5_locl.h"
 
-RCSID("$Id: keytab_any.c,v 1.1.1.1 2001/06/19 22:08:21 assar Exp $");
+RCSID("$Id: keytab_any.c,v 1.2 2001/07/18 21:54:56 assar Exp $");
 
 struct any_data {
     krb5_keytab kt;
@@ -68,7 +68,7 @@
        }
        if (a0 == NULL) {
            a0 = a;
-           a->name = strdup(name);
+           a->name = strdup(buf);
            if (a->name == NULL) {
                krb5_set_error_string(context, "malloc: out of memory");
                ret = ENOMEM;
@@ -139,11 +139,9 @@
     ed->a = a;
     ret = krb5_kt_start_seq_get(context, ed->a->kt, &ed->cursor);
     if (ret) {
-       free (ed);
        free (c->data);
        c->data = NULL;
-       krb5_set_error_string (context, "malloc: out of memory");
-       return ENOMEM;
+       return ret;
     }
     return 0;
 }
@@ -166,14 +164,15 @@
            ret2 = krb5_kt_end_seq_get (context, ed->a->kt, &ed->cursor);
            if (ret2)
                return ret2;
-           ed->a = ed->a->next;
+           while ((ed->a = ed->a->next) != NULL) {
+               ret2 = krb5_kt_start_seq_get(context, ed->a->kt, &ed->cursor);
+               if (ret2 == 0)
+                   break;
+           }
            if (ed->a == NULL) {
                krb5_clear_error_string (context);
                return KRB5_CC_END;
            }
-           ret2 = krb5_kt_start_seq_get(context, ed->a->kt, &ed->cursor);
-           if (ret2)
-               return ret2;
        } else
            return ret;
     } while (ret == KRB5_CC_END);



Home | Main Index | Thread Index | Old Index