From a8bbbda107a2f95f4b103ec2b89b431797c42a60 Mon Sep 17 00:00:00 2001
From: Lev Walkin <vlm@lionet.info>
Date: Sun, 6 Feb 2005 04:29:03 +0000
Subject: [PATCH] handling temporary structure

---
 skeletons/NativeReal.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/skeletons/NativeReal.c b/skeletons/NativeReal.c
index 594bdb5f..810d510b 100644
--- a/skeletons/NativeReal.c
+++ b/skeletons/NativeReal.c
@@ -127,6 +127,9 @@ NativeReal_encode_der(asn_TYPE_descriptor_t *td, void *ptr,
 	asn_enc_rval_t erval;
 	REAL_t tmp;
 
+	/* Prepare a temporary clean structure */
+	memset(&tmp, 0, sizeof(tmp));
+
 	if(asn_double2REAL(&tmp, Dbl)) {
 		erval.encoded = -1;
 		erval.failed_type = td;
@@ -140,6 +143,10 @@ NativeReal_encode_der(asn_TYPE_descriptor_t *td, void *ptr,
 		assert(erval.structure_ptr == &tmp);
 		erval.structure_ptr = ptr;
 	}
+
+	/* Free possibly allocated members of the temporary structure */
+	asn_DEF_REAL.free_struct(&asn_DEF_REAL, &tmp, 1);
+
 	return erval;
 }
 
-- 
GitLab