bankd/client: Fix memory leak if rspro_enc_msg() fails

Change-Id: Ib72b077d82939be0627b9dd7c905fb2a33db9ca5
changes/97/13497/1
Harald Welte 4 years ago
parent 972a1e892e
commit 2eee4507ca
  1. 1
      src/bankd_main.c
  2. 4
      src/rspro_client_fsm.c

@ -435,6 +435,7 @@ static int worker_send_rspro(struct bankd_worker *worker, RsproPDU_t *pdu)
int rc;
if (!msg) {
ASN_STRUCT_FREE(asn_DEF_RsproPDU, pdu);
LOGW(worker, "error encoding RSPRO\n");
return -1;
}

@ -58,8 +58,10 @@ static void push_and_send(struct ipa_client_conn *ipa, struct msgb *msg_tx)
int ipa_client_conn_send_rspro(struct ipa_client_conn *ipa, RsproPDU_t *rspro)
{
struct msgb *msg = rspro_enc_msg(rspro);
if (!msg)
if (!msg) {
ASN_STRUCT_FREE(asn_DEF_RsproPDU, rspro);
return -1;
}
push_and_send(ipa, msg);
return 0;
}

Loading…
Cancel
Save