Skip to content
Snippets Groups Projects
Commit 91bde1d7 authored by Treehugger Robot's avatar Treehugger Robot Committed by Gerrit Code Review
Browse files

Merge "gracefully handle hashtab_search failures"

parents dbddbe42 bb880a28
Branches
No related tags found
No related merge requests found
...@@ -116,6 +116,11 @@ void *init_type_iter(void *policydbp, const char *type, bool is_attr) ...@@ -116,6 +116,11 @@ void *init_type_iter(void *policydbp, const char *type, bool is_attr)
} else { } else {
out->alltypes = TYPE_ITER_LOOKUP; out->alltypes = TYPE_ITER_LOOKUP;
out->d = static_cast<type_datum *>(hashtab_search(db->p_types.table, type)); out->d = static_cast<type_datum *>(hashtab_search(db->p_types.table, type));
if (out->d == nullptr) {
std::cerr << "\"" << type << "\" does not exist" << std::endl;
free(out);
return nullptr;
}
if (is_attr && out->d->flavor != TYPE_ATTRIB) { if (is_attr && out->d->flavor != TYPE_ATTRIB) {
std::cerr << "\"" << type << "\" MUST be an attribute in the policy" << std::endl; std::cerr << "\"" << type << "\" MUST be an attribute in the policy" << std::endl;
free(out); free(out);
... ...
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment