Replace malloc/free by new/delete

This commit is contained in:
Christian Hohnstaedt 2020-03-17 18:42:25 +01:00
parent 31088b608c
commit 7a5936eb9f
2 changed files with 5 additions and 6 deletions

View File

@ -136,8 +136,8 @@ int arguments::parse(int argc, char *argv[])
/* Setup "struct option" */
if (!long_opts)
long_opts = (struct option*)calloc(cnt +1,
sizeof(*long_opts));
long_opts = new struct option[cnt];
check_oom(long_opts);
for (i = 0; i < cnt; ++i)
opts[i].fillOption(long_opts +i);
@ -190,8 +190,7 @@ arguments &arguments::operator = (const arguments &a)
arguments::~arguments()
{
if (long_opts)
free(long_opts);
delete long_opts;
}
QString arguments::operator [] (const QString &key) const

View File

@ -126,8 +126,7 @@ static const QList<int> other_curve_nids()
builtin_curves::builtin_curves()
{
int i, num_curves = EC_get_builtin_curves(NULL, 0);
EC_builtin_curve *curves = (EC_builtin_curve*)OPENSSL_malloc(
(int)(sizeof(EC_builtin_curve) *num_curves));
EC_builtin_curve *curves = new EC_builtin_curve[num_curves];
check_oom(curves);
@ -174,6 +173,7 @@ builtin_curves::builtin_curves()
EC_GROUP_free(group);
}
BN_free(order);
delete curves;
}
#else
builtin_curves::builtin_curves() { }