libsepol: Fix valgrind errors in constraint_expr_eval_reason

Running valgrind flagged up three "definitely lost" malloc/realloc errors
when checking constraints.

Signed-off-by: Richard Haines <richard_c_haines@btinternet.com>
This commit is contained in:
Richard Haines 2013-11-03 16:00:10 +00:00 committed by Stephen Smalley
parent ab9cbb1f8e
commit 733ea08147

View File

@ -728,6 +728,7 @@ mls_ops:
push(answer_list[answer_counter++]);
free(a);
free(b);
free(expr_list[x]);
} else if (strncmp(expr_list[x], "not", 3) == 0) {
b = pop();
b_len = strlen(b);
@ -748,6 +749,7 @@ mls_ops:
expr_list[x], b);
push(answer_list[answer_counter++]);
free(b);
free(expr_list[x]);
} else {
push(expr_list[x]);
}
@ -815,6 +817,8 @@ out:
for (x = 0; expr_list[x] != NULL; x++)
free(expr_list[x]);
}
free(answer_list);
free(expr_list);
return rc;
}