Fix so that rc_dfl_resolve(id, name) works when name is NULL
authorTheodore Tso <tytso@mit.edu>
Sun, 12 Jun 1994 17:46:09 +0000 (17:46 +0000)
committerTheodore Tso <tytso@mit.edu>
Sun, 12 Jun 1994 17:46:09 +0000 (17:46 +0000)
git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@3753 dc483132-0cff-0310-8789-dd5450dbe970

src/lib/krb5/rcache/rc_dfl.c

index 0c012b7a828a54c6823a6f32e3a6b719e384c216..2130f2c539b42a5fc36a888bb16f16b89a0ebaf1 100644 (file)
@@ -254,12 +254,15 @@ char *name;
        return KRB5_RC_MALLOC;
     id->data = (krb5_pointer) t;
     memset(t, 0, sizeof(struct dfl_data));
-    t->name = malloc(strlen(name)+1);
-    if (!t->name) {
-       retval = KRB5_RC_MALLOC;
-       goto cleanup;
-    }
-    strcpy(t->name, name);
+    if (name) {
+       t->name = malloc(strlen(name)+1);
+       if (!t->name) {
+           retval = KRB5_RC_MALLOC;
+           goto cleanup;
+       }
+       strcpy(t->name, name);
+    } else
+       t->name = 0;
     t->numhits = t->nummisses = 0;
     t->hsize = HASHSIZE; /* no need to store---it's memory-only */
     t->h = (struct authlist **) malloc(t->hsize*sizeof(struct authlist *));