Fix mem leaks

This commit is contained in:
emanuel 2023-04-18 10:10:02 +01:00
parent e3485b0afc
commit dfa34c4ab0
2 changed files with 3 additions and 6 deletions

View File

@ -754,6 +754,7 @@ enum CAM_CHECK_R check_cam(BTPPacketIndication_t *bpi, CAM_t* cam, uint8_t* ssp,
}
asn_enc_rval_t enc = oer_encode_to_buffer(&asn_DEF_ManagementRequest, NULL, mreq, b_oer, 512);
ASN_STRUCT_FREE(asn_DEF_ManagementRequest, mreq);
void* management_socket = itss_0connect(facilities.zmq.management_address, ZMQ_REQ);
itss_0send(management_socket, b_oer, enc.encoded);
log_debug("[ca]-> sending MReq.attributes.set.protectedZones to ->[management]");
@ -905,6 +906,7 @@ void* ca_service() {
}
ASN_STRUCT_FREE(asn_DEF_TransportRequest, tr);
ASN_STRUCT_FREE(asn_DEF_FacilitiesIndication, fi);
return NULL;
}

View File

@ -47,13 +47,8 @@ facilities_t facilities = {0};
static int transport_indication(void *responder, void **security_socket, uint8_t *msg, uint32_t msg_len) {
int rv = 0;
uint8_t code = 0;
FacilitiesIndication_t *fi = NULL;
SecurityRequest_t *sreq = NULL;
SecurityReply_t *srep = NULL;
TransportRequest_t *tr = NULL;
bool stored = false;
TransportIndication_t *ti = calloc(1, sizeof(TransportIndication_t));
asn_dec_rval_t dec = oer_decode(NULL, &asn_DEF_TransportIndication, (void **)&ti, msg, msg_len);
@ -105,7 +100,7 @@ static int transport_indication(void *responder, void **security_socket, uint8_t
cleanup:
ASN_STRUCT_FREE(asn_DEF_TransportRequest, tr);
ASN_STRUCT_FREE(asn_DEF_TransportIndication, ti);
return rv;
}