Commit 671eb9ad authored by Markus Elfring's avatar Markus Elfring

Bug #86: Deletion of unnecessary checks before a few calls of asn1c functions

The following functions return immediately if a null pointer was passed.
* asn1p_constraint_free
* asn1p_paramlist_free
* asn1p_ref_free
* asn1p_value_free
* asn1p_wsyntx_free

It is therefore not needed that a function caller repeats a corresponding check.

This issue was fixed by using the software "Coccinelle 1.0.4".
Signed-off-by: default avatarMarkus Elfring <elfring@users.sourceforge.net>
parent 0ec6b19a
......@@ -23,13 +23,9 @@ void
asn1p_constraint_free(asn1p_constraint_t *ct) {
if(ct) {
if(ct->containedSubtype)
asn1p_value_free(ct->containedSubtype);
if(ct->value)
asn1p_value_free(ct->value);
if(ct->range_start)
asn1p_value_free(ct->range_start);
if(ct->range_stop)
asn1p_value_free(ct->range_stop);
if(ct->elements) {
......
......@@ -246,19 +246,12 @@ asn1p_expr_free(asn1p_expr_t *expr) {
}
free(expr->Identifier);
if(expr->reference)
asn1p_ref_free(expr->reference);
if(expr->constraints)
asn1p_constraint_free(expr->constraints);
if(expr->combined_constraints)
asn1p_constraint_free(expr->combined_constraints);
if(expr->lhs_params)
asn1p_paramlist_free(expr->lhs_params);
if(expr->value)
asn1p_value_free(expr->value);
if(expr->marker.default_value)
asn1p_value_free(expr->marker.default_value);
if(expr->with_syntax)
asn1p_wsyntx_free(expr->with_syntax);
if(expr->data && expr->data_free)
......
......@@ -27,7 +27,6 @@ asn1p_paramlist_free(asn1p_paramlist_t *pl) {
if(pl->params) {
int i = pl->params_count;
while(i--) {
if(pl->params[i].governor)
asn1p_ref_free(pl->params[i].governor);
free(pl->params[i].argument);
pl->params[i].governor = 0;
......@@ -82,7 +81,6 @@ asn1p_paramlist_add_param(asn1p_paramlist_t *pl, asn1p_ref_t *gov, char *arg) {
pl->params_count++;
return 0;
} else {
if(pl->params[pl->params_count].governor)
asn1p_ref_free(pl->params[pl->params_count].governor);
return -1;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment