ALL: fix memory leaks
This commit is contained in:
parent
8871b496c2
commit
7f23aa2a35
@ -397,7 +397,7 @@ poly_to_base64(fmpz_poly_t poly,
|
||||
result_string->ptr = base64_string;
|
||||
result_string->len = strlen(base64_string);
|
||||
|
||||
free(string_rep);
|
||||
string_delete(string_rep);
|
||||
free(tmp);
|
||||
|
||||
return result_string;
|
||||
|
@ -121,6 +121,7 @@ export_priv_key(char const * const filename,
|
||||
priv_string = poly_to_base64(priv_u, ctx);
|
||||
write_file(priv_string, filename);
|
||||
|
||||
fmpz_poly_clear(priv_u);
|
||||
string_delete(priv_string);
|
||||
}
|
||||
|
||||
@ -145,7 +146,7 @@ import_public_key(char const * const filename,
|
||||
fmpz_poly_set(pub, **imported);
|
||||
|
||||
string_delete(pub_string);
|
||||
poly_delete(**imported);
|
||||
poly_delete_array(imported);
|
||||
free(imported);
|
||||
}
|
||||
|
||||
@ -185,7 +186,7 @@ import_priv_key(char const * const filename,
|
||||
|
||||
cleanup:
|
||||
string_delete(pub_string);
|
||||
poly_delete(**imported);
|
||||
poly_delete_array(imported);
|
||||
free(imported);
|
||||
}
|
||||
|
||||
|
@ -117,10 +117,13 @@ poly_delete_array(fmpz_poly_t **poly_array)
|
||||
|
||||
while(poly_array[i]) {
|
||||
poly_delete(*(poly_array[i]));
|
||||
free(*(poly_array[i]));
|
||||
free(poly_array[i]);
|
||||
i++;
|
||||
}
|
||||
free(poly_array);
|
||||
|
||||
/* avoid double free */
|
||||
if (i > 1)
|
||||
free(poly_array);
|
||||
}
|
||||
|
||||
/*------------------------------------------------------------------------*/
|
||||
|
Loading…
Reference in New Issue
Block a user