@@ -12374,14 +12374,16 @@ int wc_DsaPublicKeyDecode(const byte* input, word32* inOutIdx, DsaKey* key,
1237412374 /* dsaPubKeyASN is longer than dsaPublicKeyASN. */
1237512375 DECL_ASNGETDATA(dataASN, dsaPubKeyASN_Length);
1237612376 int ret = 0;
12377+ void* heap = NULL;
1237712378
1237812379 /* Validated parameters. */
1237912380 if ((input == NULL) || (inOutIdx == NULL) || (key == NULL)) {
1238012381 ret = BAD_FUNC_ARG;
1238112382 }
12383+ heap = (key != NULL) ? key->heap : NULL;
1238212384
1238312385 if (ret == 0) {
12384- ALLOC_ASNGETDATA(dataASN, dsaPubKeyASN_Length, ret, key-> heap);
12386+ ALLOC_ASNGETDATA(dataASN, dsaPubKeyASN_Length, ret, heap);
1238512387 }
1238612388
1238712389 if (ret == 0) {
@@ -12420,7 +12422,7 @@ int wc_DsaPublicKeyDecode(const byte* input, word32* inOutIdx, DsaKey* key,
1242012422 key->type = DSA_PUBLIC;
1242112423 }
1242212424
12423- FREE_ASNGETDATA(dataASN, key-> heap);
12425+ FREE_ASNGETDATA(dataASN, heap);
1242412426 return ret;
1242512427#endif
1242612428}
@@ -37539,6 +37541,7 @@ int wc_EccPublicKeyDecode(const byte* input, word32* inOutIdx,
3753937541 /* eccKeyASN is longer than eccPublicKeyASN. */
3754037542 DECL_ASNGETDATA(dataASN, eccKeyASN_Length);
3754137543 int ret = 0;
37544+ void* heap = NULL;
3754237545 int curve_id = ECC_CURVE_DEF;
3754337546 int oidIdx = ECCPUBLICKEYASN_IDX_ALGOID_CURVEID;
3754437547#ifdef WOLFSSL_CUSTOM_CURVES
@@ -37549,9 +37552,10 @@ int wc_EccPublicKeyDecode(const byte* input, word32* inOutIdx,
3754937552 if ((input == NULL) || (inOutIdx == NULL) || (key == NULL) || (inSz == 0)) {
3755037553 ret = BAD_FUNC_ARG;
3755137554 }
37555+ heap = (key != NULL) ? key->heap : NULL;
3755237556
3755337557 if (ret == 0) {
37554- ALLOC_ASNGETDATA(dataASN, eccKeyASN_Length, ret, key-> heap);
37558+ ALLOC_ASNGETDATA(dataASN, eccKeyASN_Length, ret, heap);
3755537559 }
3755637560
3755737561 if (ret == 0) {
@@ -37625,7 +37629,7 @@ int wc_EccPublicKeyDecode(const byte* input, word32* inOutIdx,
3762537629 }
3762637630 }
3762737631
37628- FREE_ASNGETDATA(dataASN, key-> heap);
37632+ FREE_ASNGETDATA(dataASN, heap);
3762937633 return ret;
3763037634#endif /* WOLFSSL_ASN_TEMPLATE */
3763137635}
0 commit comments