Avoid memory leaks if one of the parameters --modulus, --ecc-x,
or --ecc-y was passed multiple times by freeing the previously
parsed value.
Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
pubkey_filename = optarg;
break;
case 'm': /* --modulus */
+ free(modulus_bin);
if (!(modulus_bin = hex_str_to_bin(optarg, &modulus_len))) {
goto cleanup;
}
break;
case 'x': /* --ecc-x */
+ free(ecc_x_bin);
if (!(ecc_x_bin = hex_str_to_bin(optarg, &ecc_x_len))) {
goto cleanup;
}
break;
case 'y': /* --ecc-y */
+ free(ecc_y_bin);
if (!(ecc_y_bin = hex_str_to_bin(optarg, &ecc_y_len))) {
goto cleanup;
}