(_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:
@@ -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).
|
||||
* All rights reserved.
|
||||
*
|
||||
@@ -81,6 +81,15 @@ _krb5_get_init_creds_opt_copy(krb5_context context,
|
||||
return ENOMEM;
|
||||
}
|
||||
*opt = *in;
|
||||
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;
|
||||
return 0;
|
||||
|
Reference in New Issue
Block a user