forked from acouzens/open5gs
FIX all memory leak. Next, script is improved to provide
s1ap_decode_free function
This commit is contained in:
parent
2d38a99060
commit
70e70dc5a6
File diff suppressed because it is too large
Load Diff
|
@ -30,7 +30,7 @@
|
|||
/*******************************************************************************
|
||||
* This file had been created by asn1tostruct.py script v1.0.2
|
||||
* Please do not modify this file but regenerate it via script.
|
||||
* Created on: 2017-02-09 15:35:22.449520 by acetcom
|
||||
* Created on: 2017-02-09 17:41:52.994214 by acetcom
|
||||
* from ['S1AP-PDU.asn']
|
||||
******************************************************************************/
|
||||
#include "s1ap_asn1c.h"
|
||||
|
|
|
@ -30,7 +30,7 @@
|
|||
/*******************************************************************************
|
||||
* This file had been created by asn1tostruct.py script v1.0.2
|
||||
* Please do not modify this file but regenerate it via script.
|
||||
* Created on: 2017-02-09 15:35:22.493530 by acetcom
|
||||
* Created on: 2017-02-09 17:41:53.036672 by acetcom
|
||||
* from ['S1AP-PDU.asn']
|
||||
******************************************************************************/
|
||||
#include "core_debug.h"
|
||||
|
|
|
@ -30,7 +30,7 @@
|
|||
/*******************************************************************************
|
||||
* This file had been created by asn1tostruct.py script v1.0.2
|
||||
* Please do not modify this file but regenerate it via script.
|
||||
* Created on: 2017-02-09 15:35:22.509808 by acetcom
|
||||
* Created on: 2017-02-09 17:41:53.053901 by acetcom
|
||||
* from ['S1AP-PDU.asn']
|
||||
******************************************************************************/
|
||||
#include <stdlib.h>
|
||||
|
|
|
@ -393,6 +393,7 @@ for key in iesDefs:
|
|||
f.write(" dec_ret = aper_decode(NULL, &asn_DEF_%s, (void **)&%s_p, any_p->buf, any_p->size, 0, 0);\n" % (asn1cStruct, asn1cStructfirstlower));
|
||||
f.write(" if (dec_ret.code != RC_OK)\n")
|
||||
f.write(" {\n")
|
||||
f.write(" d_error(\"Decoding of IE %s failed\");\n" % (asn1cStructfirstlower))
|
||||
f.write(" ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_%s, %s_p);\n" % (asn1cStruct, asn1cStructfirstlower));
|
||||
f.write(" return -1;\n")
|
||||
f.write(" }\n\n");
|
||||
|
@ -424,16 +425,17 @@ for key in iesDefs:
|
|||
f.write(" if (%s_decode_%s(&%s->%s, %s_p) < 0)\n" % (fileprefix, ietypeunderscore.lower(), lowerFirstCamelWord(re.sub('-', '_', key)), ienameunderscore, lowerFirstCamelWord(ietypesubst)))
|
||||
f.write(" {\n")
|
||||
f.write(" d_error(\"Decoding of encapsulated IE %s failed\");\n" % (lowerFirstCamelWord(ietypesubst)))
|
||||
f.write(" ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_%s, %s_p);\n" % (ietypeunderscore, lowerFirstCamelWord(ietypesubst)))
|
||||
f.write(" ASN_STRUCT_FREE(asn_DEF_%s, %s_p);\n" % (ietypeunderscore, lowerFirstCamelWord(ietypesubst)))
|
||||
f.write(" ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_%s, %s_p);\n" % (asn1cStruct, lowerFirstCamelWord(asn1cStruct)))
|
||||
f.write(" return -1;\n")
|
||||
f.write(" }\n")
|
||||
f.write(" ASN_STRUCT_FREE(asn_DEF_%s, %s_p);\n" % (ietypeunderscore, lowerFirstCamelWord(ietypesubst)))
|
||||
else:
|
||||
f.write(" %s_t *%s_p = &%s->%s;\n\n" % (ietypeunderscore, lowerFirstCamelWord(ietypesubst), lowerFirstCamelWord(re.sub('-', '_', key)), ienameunderscore))
|
||||
f.write(" dec_ret = aper_decode(NULL, &asn_DEF_%s, (void **)&%s_p, st->buf, st->size, 0, 0);\n" % (ietypeunderscore, lowerFirstCamelWord(ietypesubst)))
|
||||
f.write(" if (dec_ret.code != RC_OK)\n")
|
||||
f.write(" {\n")
|
||||
f.write(" ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_%s, %s_p);\n" % (ietypeunderscore, lowerFirstCamelWord(ietypesubst)))
|
||||
f.write(" d_error(\"Decoding of IE %s failed\");\n" % (lowerFirstCamelWord(ietypesubst)))
|
||||
f.write(" ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_%s, %s_p);\n" % (asn1cStruct, lowerFirstCamelWord(asn1cStruct)))
|
||||
f.write(" return -1;\n")
|
||||
f.write(" }\n")
|
||||
|
|
|
@ -113,12 +113,24 @@ static void s1ap_test3(abts_case *tc, void *data)
|
|||
&ie->mme_ue_s1ap_id);
|
||||
ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_S1ap_ENB_UE_S1AP_ID,
|
||||
&ie->eNB_UE_S1AP_ID);
|
||||
#if 0
|
||||
ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_S1ap_E_RABSetupListCtxtSURes_IEs,
|
||||
&ie->e_RABSetupListCtxtSURes);
|
||||
ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_S1ap_E_RABList_IEs,
|
||||
&ie->e_RABFailedToSetupListCtxtSURes);
|
||||
#endif
|
||||
{
|
||||
int i = 0;
|
||||
for (i = 0; i < ie->e_RABSetupListCtxtSURes.s1ap_E_RABSetupItemCtxtSURes.count; i++)
|
||||
{
|
||||
ASN_STRUCT_FREE(asn_DEF_S1ap_E_RABSetupItemCtxtSURes,
|
||||
ie->e_RABSetupListCtxtSURes.s1ap_E_RABSetupItemCtxtSURes.array[i]);
|
||||
}
|
||||
FREEMEM(ie->e_RABSetupListCtxtSURes.s1ap_E_RABSetupItemCtxtSURes.array);
|
||||
}
|
||||
{
|
||||
int i = 0;
|
||||
for (i = 0; i < ie->e_RABFailedToSetupListCtxtSURes.s1ap_E_RABItem.count; i++)
|
||||
{
|
||||
ASN_STRUCT_FREE(asn_DEF_S1ap_E_RABItem,
|
||||
ie->e_RABFailedToSetupListCtxtSURes.s1ap_E_RABItem.array[i]);
|
||||
}
|
||||
FREEMEM(ie->e_RABFailedToSetupListCtxtSURes.s1ap_E_RABItem.array);
|
||||
}
|
||||
ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_S1ap_CriticalityDiagnostics,
|
||||
&ie->criticalityDiagnostics);
|
||||
|
||||
|
|
Loading…
Reference in New Issue