Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
Nettle
nettle
Commits
af7d1d76
Commit
af7d1d76
authored
Jul 12, 2018
by
Niels Möller
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make eccdata deallocate storage before exit.
parent
1da75fad
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
28 additions
and
0 deletions
+28
-0
ChangeLog
ChangeLog
+2
-0
eccdata.c
eccdata.c
+26
-0
No files found.
ChangeLog
View file @
af7d1d76
...
...
@@ -2,6 +2,8 @@
* eccdata.c (output_curve): Replace mpz_init_set_ui by mpz_set_ui,
to fix memory leak.
(ecc_curve_clear): New function.
(main): Call it, to deallocate storage before exit.
2018-07-08 Niels Möller <nisse@lysator.liu.se>
...
...
eccdata.c
View file @
af7d1d76
...
...
@@ -611,6 +611,31 @@ ecc_curve_init (struct ecc_curve *ecc, unsigned bit_size)
ecc
->
bit_size
=
bit_size
;
}
static
void
ecc_curve_clear
(
struct
ecc_curve
*
ecc
)
{
mpz_clear
(
ecc
->
p
);
mpz_clear
(
ecc
->
b
);
mpz_clear
(
ecc
->
q
);
ecc_clear
(
&
ecc
->
g
);
mpz_clear
(
ecc
->
d
);
mpz_clear
(
ecc
->
t
);
if
(
ecc
->
table
)
{
size_t
i
;
for
(
i
=
0
;
i
<
ecc
->
table_size
;
i
++
)
ecc_clear
(
&
ecc
->
table
[
i
]);
free
(
ecc
->
table
);
}
if
(
ecc
->
ref
)
{
size_t
i
;
for
(
i
=
0
;
i
<
3
;
i
++
)
ecc_clear
(
&
ecc
->
ref
[
i
]);
free
(
ecc
->
ref
);
}
}
static
unsigned
ecc_table_size
(
unsigned
bits
,
unsigned
k
,
unsigned
c
)
{
...
...
@@ -1180,5 +1205,6 @@ main (int argc, char **argv)
if
(
argc
>
4
)
output_curve
(
&
ecc
,
atoi
(
argv
[
4
]));
ecc_curve_clear
(
&
ecc
);
return
EXIT_SUCCESS
;
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment