aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHarald Welte <laforge@gnumonks.org>2018-09-24 17:43:39 +0200
committerHarald Welte <laforge@gnumonks.org>2018-09-24 17:46:05 +0200
commit9ebbacc801da9f6ba590ffd14a174bd89be6b5a9 (patch)
tree0388089751ce7f0926baee6b2b75cab7ac1d725e
parent7b94dc231dbe30f0b39d1daefbec788aec64e830 (diff)
correctly use asn1c API: PDU pointers must be NULL when calling decoder
If the pointers are != NULL, asn1c assumes their memory has already been allocated, rather than dynamically allocating storage for it. Change-Id: I6b78be75d8927f032ca4051520a3053b3fbf9e13
-rw-r--r--src/bankd_main.c2
-rw-r--r--src/rspro_util.c2
2 files changed, 2 insertions, 2 deletions
diff --git a/src/bankd_main.c b/src/bankd_main.c
index f84d0d0..a2dccea 100644
--- a/src/bankd_main.c
+++ b/src/bankd_main.c
@@ -374,7 +374,7 @@ static int worker_transceive_loop(struct bankd_worker *worker)
uint8_t buf[65536]; /* maximum length expressed in 16bit length field */
asn_dec_rval_t rval;
int data_len, rc;
- RsproPDU_t *pdu;
+ RsproPDU_t *pdu = NULL;
/* 1) blocking read of entire IPA message from the socket */
rc = blocking_ipa_read(worker->client.fd, buf, sizeof(buf));
diff --git a/src/rspro_util.c b/src/rspro_util.c
index 79c7c03..82adb88 100644
--- a/src/rspro_util.c
+++ b/src/rspro_util.c
@@ -51,7 +51,7 @@ struct msgb *rspro_enc_msg(RsproPDU_t *pdu)
/* consumes 'msg' _if_ it is successful */
RsproPDU_t *rspro_dec_msg(struct msgb *msg)
{
- RsproPDU_t *pdu;
+ RsproPDU_t *pdu = NULL;
asn_dec_rval_t rval;
printf("decoding %s\n", msgb_hexdump(msg));