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

Merge "Fix static analyzer warnings."

parents df964950 3cdd4a4b
No related branches found
No related tags found
No related merge requests found
...@@ -261,6 +261,7 @@ static int read_classperms(policydb_t *policydb, char **ptr, char *end, ...@@ -261,6 +261,7 @@ static int read_classperms(policydb_t *policydb, char **ptr, char *end,
node->next = classperms; node->next = classperms;
classperms = node; classperms = node;
free(id); free(id);
id = NULL;
} while (p < end && openparens); } while (p < end && openparens);
if (p == end) if (p == end)
...@@ -328,6 +329,8 @@ static int read_classperms(policydb_t *policydb, char **ptr, char *end, ...@@ -328,6 +329,8 @@ static int read_classperms(policydb_t *policydb, char **ptr, char *end,
if (!strcmp(id, "*")) { if (!strcmp(id, "*")) {
for (node = classperms; node; node = node->next) for (node = classperms; node; node = node->next)
node->data = ~0; node->data = ~0;
free(id);
id = NULL;
continue; continue;
} }
...@@ -344,6 +347,7 @@ static int read_classperms(policydb_t *policydb, char **ptr, char *end, ...@@ -344,6 +347,7 @@ static int read_classperms(policydb_t *policydb, char **ptr, char *end,
node->data |= 1U << (perm->s.value - 1); node->data |= 1U << (perm->s.value - 1);
} }
free(id); free(id);
id = NULL;
} while (p < end && openparens); } while (p < end && openparens);
if (p == end) if (p == end)
...@@ -364,6 +368,12 @@ static int read_classperms(policydb_t *policydb, char **ptr, char *end, ...@@ -364,6 +368,12 @@ static int read_classperms(policydb_t *policydb, char **ptr, char *end,
*ptr = p; *ptr = p;
return 0; return 0;
err: err:
// free classperms memory
for (node = classperms; node; ) {
class_perm_node_t *freeptr = node;
node = node->next;
free(freeptr);
}
return -1; return -1;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment