Commit d8b8364c authored by Lev Walkin's avatar Lev Walkin

removed unneeded check before free()

parent c6b34cc6
......@@ -1048,8 +1048,7 @@ asn1c_lang_C_type_REFERENCE(arg_t *arg) {
extract = asn1p_expr_clone(extract, 0);
if(extract) {
if(extract->Identifier)
free(extract->Identifier);
free(extract->Identifier);
extract->Identifier = strdup(arg->expr->Identifier);
if(extract->Identifier == NULL) {
asn1p_expr_free(extract);
......@@ -1707,7 +1706,7 @@ emit_tags_vectors(arg_t *arg, asn1p_expr_t *expr, int *tags_count_r, int *all_ta
all_tags_count = asn1f_fetch_tags(arg->asn, expr->module, expr,
&all_tags, AFT_FULL_COLLECT);
if(all_tags_count < 0) {
if(tags) free(tags);
free(tags);
DEBUG("fail to fetch tags chain for %s", expr->Identifier);
return -1;
}
......@@ -1756,8 +1755,8 @@ emit_tags_vectors(arg_t *arg, asn1p_expr_t *expr, int *tags_count_r, int *all_ta
EMIT_TAGS_TABLE("_all", all_tags, all_tags_count);
}
if(tags) free(tags);
if(all_tags) free(all_tags);
free(tags);
free(all_tags);
*tags_count_r = tags_count;
*all_tags_count_r = all_tags_count;
......
......@@ -78,7 +78,7 @@ asn1c_make_identifier(enum ami_flags_e flags, asn1p_expr_t *expr, ...) {
* Make sure we have this amount of storage.
*/
if(storage_size <= size) {
if(storage) free(storage);
free(storage);
storage = malloc(size + 1);
if(storage) {
storage_size = size;
......
......@@ -245,8 +245,7 @@ asn1p_expr_free(asn1p_expr_t *expr) {
asn1p_expr_free(tm);
}
if(expr->Identifier)
free(expr->Identifier);
free(expr->Identifier);
if(expr->reference)
asn1p_ref_free(expr->reference);
if(expr->constraints)
......
......@@ -27,8 +27,7 @@ asn1p_module_free(asn1p_module_t *mod) {
if(mod) {
asn1p_expr_t *expr;
if(mod->ModuleName)
free(mod->ModuleName);
free(mod->ModuleName);
if(mod->module_oid)
asn1p_oid_free(mod->module_oid);
......
......@@ -50,7 +50,6 @@ asn1p_oid_free(asn1p_oid_t *oid) {
if(oid) {
if(oid->arcs) {
while(oid->arcs_count--) {
if(oid->arcs[oid->arcs_count].name)
free(oid->arcs[oid->arcs_count].name);
}
}
......@@ -75,8 +74,7 @@ asn1p_oid_arc_new(const char *optName, asn1c_integer_t optNumber /* = -1 */) {
void
asn1p_oid_arc_free(asn1p_oid_arc_t *arc) {
if(arc) {
if(arc->name)
free(arc->name);
free(arc->name);
free(arc);
}
}
......
......@@ -29,8 +29,7 @@ asn1p_paramlist_free(asn1p_paramlist_t *pl) {
while(i--) {
if(pl->params[i].governor)
asn1p_ref_free(pl->params[i].governor);
if(pl->params[i].argument)
free(pl->params[i].argument);
free(pl->params[i].argument);
pl->params[i].governor = 0;
pl->params[i].argument = 0;
}
......
......@@ -27,7 +27,6 @@ asn1p_ref_free(asn1p_ref_t *ref) {
if(ref->components) {
int i = ref->comp_count;
while(i--) {
if(ref->components[i].name)
free(ref->components[i].name);
ref->components[i].name = 0;
}
......
......@@ -25,8 +25,7 @@ asn1p_xports_new() {
void
asn1p_xports_free(asn1p_xports_t *xp) {
if(xp) {
if(xp->fromModuleName)
free(xp->fromModuleName);
free(xp->fromModuleName);
if(xp->identifier.oid)
asn1p_oid_free(xp->identifier.oid);
free(xp);
......
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