(_krb5_get_init_creds_opt_copy): if copying a static opt, make sure to

allocate the "private" field


git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@13985 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
Johan Danielsson
2004-06-24 11:40:26 +00:00
parent 51b24c714f
commit 40f01e011c

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 1997 - 2001, 2003 Kungliga Tekniska H<>gskolan * Copyright (c) 1997 - 2004 Kungliga Tekniska H<>gskolan
* (Royal Institute of Technology, Stockholm, Sweden). * (Royal Institute of Technology, Stockholm, Sweden).
* All rights reserved. * All rights reserved.
* *
@@ -81,7 +81,16 @@ _krb5_get_init_creds_opt_copy(krb5_context context,
return ENOMEM; return ENOMEM;
} }
*opt = *in; *opt = *in;
opt->private->refcount++; if(opt->private == NULL) {
opt->private = calloc(1, sizeof(*opt->private));
if (opt->private == NULL) {
krb5_set_error_string(context, "out of memory");
free(opt);
return ENOMEM;
}
opt->private->refcount = 1;
} else
opt->private->refcount++;
*out = opt; *out = opt;
return 0; return 0;
} }