Fixed crash in kim_options_write_to_stream
authorAlexandra Ellwood <lxs@mit.edu>
Wed, 1 Oct 2008 21:16:44 +0000 (21:16 +0000)
committerAlexandra Ellwood <lxs@mit.edu>
Wed, 1 Oct 2008 21:16:44 +0000 (21:16 +0000)
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

index 68f53d665c396ad663bfbfe6823942f3fa74f381..8cefa2ecf3ebb7e91f40ddc0ab23a6f7f6d76701 100644 (file)
@@ -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);    
 }