From 92a288ca6bc009cef73fc0bd97d6a77b0e9c77e0 Mon Sep 17 00:00:00 2001
From: Kristof Szabados <Kristof.Szabados@ericsson.com>
Date: Sat, 1 Dec 2018 16:51:05 +0100
Subject: [PATCH] it is enough to allocate a when limit is not 0.

Signed-off-by: Kristof Szabados <Kristof.Szabados@ericsson.com>
---
 compiler2/record_of.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/compiler2/record_of.c b/compiler2/record_of.c
index 1825ce45c..b4544edcb 100644
--- a/compiler2/record_of.c
+++ b/compiler2/record_of.c
@@ -986,13 +986,13 @@ void defRecordOfClass1(const struct_of_def *sdef, output_struct *output)
     "    }\n"
     "    if(a==0) val_ptr->n_elements=0;\n"
     "  } else {\n"
-    "    int a=start_field;\n"
     "    if(limit==0){\n"
     "      if(!first_call) return -1;\n"
     "      val_ptr->n_elements=0;\n"
     "      return decoded_length+p_buf.increase_pos_padd(p_td.raw->padding)"
     "+prepaddlength;\n"
     "    }\n"
+    "    int a=start_field;\n"
     "    while(limit>0){\n"
     "      start_of_field=p_buf.get_pos_bit();\n"
     "      decoded_field_length=(*this)[a].RAW_decode(*p_td.oftype_descr,p_buf,limit,"
-- 
GitLab