Skip to content

Commit

Permalink
Fix memory allocation issues.
Browse files Browse the repository at this point in the history
  • Loading branch information
dfaranha committed Aug 8, 2024
1 parent c3d0c35 commit 7d60a4b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/ep/relic_ep_map.c
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,7 @@ void ep_map_swift(ep_t p, const uint8_t *msg, size_t len) {
bn_null(k);
fp_null(v);
fp_null(w);
fp_null(y);
fp_null(t1);
fp_null(t2);
fp_null(x1);
Expand All @@ -271,6 +272,7 @@ void ep_map_swift(ep_t p, const uint8_t *msg, size_t len) {
bn_new(k);
fp_new(v);
fp_new(w);
fp_new(y);
fp_new(t1);
fp_new(t2);
fp_new(x1);
Expand Down Expand Up @@ -478,6 +480,7 @@ void ep_map_swift(ep_t p, const uint8_t *msg, size_t len) {
bn_free(k);
fp_free(v);
fp_free(w);
fp_free(y);
fp_free(t1);
fp_free(t2);
fp_free(x1);
Expand All @@ -488,8 +491,7 @@ void ep_map_swift(ep_t p, const uint8_t *msg, size_t len) {
fp_free(d[2]);
RLC_FREE(pseudo_random_bytes);
for (size_t i = 0; i < 8; i++) {
fp_null(h[i]);
fp_new(h[i]);
fp_free(h[i]);
}
}
}
Expand Down
6 changes: 6 additions & 0 deletions src/epx/relic_ep2_map.c
Original file line number Diff line number Diff line change
Expand Up @@ -516,6 +516,12 @@ void ep2_map_swift(ep2_t p, const uint8_t *msg, size_t len) {
}
RLC_FINALLY {
bn_free(k);
fp2_free(a);
fp2_free(b);
fp2_free(c);
fp2_free(d);
fp2_free(e);
fp2_free(f);
fp2_free(t);
fp2_free(u);
fp2_free(v);
Expand Down

0 comments on commit 7d60a4b

Please sign in to comment.