From 3c1a043bf4972ff20e1c3d0d63a4f88f5d9ad5a5 Mon Sep 17 00:00:00 2001 From: Alexandra Ellwood Date: Wed, 1 Oct 2008 21:16:44 +0000 Subject: [PATCH] Fixed crash in kim_options_write_to_stream when in_options is KIM_OPTIONS_DEFAULT. ticket: 6055 git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@20803 dc483132-0cff-0310-8789-dd5450dbe970 --- src/kim/lib/kim_options.c | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/src/kim/lib/kim_options.c b/src/kim/lib/kim_options.c index 68f53d665..8cefa2ecf 100644 --- a/src/kim/lib/kim_options.c +++ b/src/kim/lib/kim_options.c @@ -522,52 +522,50 @@ kim_error kim_options_write_to_stream (kim_options in_options, k5_ipc_stream io_stream) { kim_error err = KIM_NO_ERROR; - kim_options options = NULL; + kim_options options = in_options; if (!err && !io_stream ) { err = check_error (KIM_NULL_PARAMETER_ERR); } if (!err && !in_options) { - err = kim_options_create(&options); - } else { - err = kim_options_copy(&options, in_options); + err = kim_options_create (&options); } if (!err) { - err = k5_ipc_stream_write_int64 (io_stream, in_options->start_time); + err = k5_ipc_stream_write_int64 (io_stream, options->start_time); } if (!err) { - err = k5_ipc_stream_write_int64 (io_stream, in_options->lifetime); + err = k5_ipc_stream_write_int64 (io_stream, options->lifetime); } if (!err) { - err = k5_ipc_stream_write_int32 (io_stream, in_options->renewable); + err = k5_ipc_stream_write_int32 (io_stream, options->renewable); } if (!err) { err = k5_ipc_stream_write_int64 (io_stream, - in_options->renewal_lifetime); + options->renewal_lifetime); } if (!err) { - err = k5_ipc_stream_write_int32 (io_stream, in_options->forwardable); + err = k5_ipc_stream_write_int32 (io_stream, options->forwardable); } if (!err) { - err = k5_ipc_stream_write_int32 (io_stream, in_options->proxiable); + err = k5_ipc_stream_write_int32 (io_stream, options->proxiable); } if (!err) { - err = k5_ipc_stream_write_int32 (io_stream, in_options->addressless); + err = k5_ipc_stream_write_int32 (io_stream, options->addressless); } if (!err) { - kim_string service_name = (in_options->service_name ? - in_options->service_name : ""); + kim_string service_name = (options->service_name ? + options->service_name : ""); err = k5_ipc_stream_write_string (io_stream, service_name); } - kim_options_free(&options); + if (options != in_options) { kim_options_free (&options); } return check_error (err); } -- 2.26.2