Skip to content
Snippets Groups Projects
Commit 20ad01ed authored by Manoj Gupta's avatar Manoj Gupta Committed by android-build-merger
Browse files

Merge "Fix static analyzer warnings." am: 4b547a15

am: 508db351

Change-Id: I123d86d49b0f17d74d7108f101720101254ea810
parents b057d62e 508db351
No related branches found
No related tags found
No related merge requests found
...@@ -258,6 +258,7 @@ static int read_classperms(policydb_t *policydb, char **ptr, char *end, ...@@ -258,6 +258,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)
...@@ -325,6 +326,8 @@ static int read_classperms(policydb_t *policydb, char **ptr, char *end, ...@@ -325,6 +326,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;
} }
...@@ -341,6 +344,7 @@ static int read_classperms(policydb_t *policydb, char **ptr, char *end, ...@@ -341,6 +344,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)
...@@ -361,6 +365,12 @@ static int read_classperms(policydb_t *policydb, char **ptr, char *end, ...@@ -361,6 +365,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