Commits

Geremy Condra  committed 7f90cf4 Merge

Merge "Eliminate a memory leak."

  • Participants
  • Parent commits 4f2b056, 300bebb

Comments (0)

Files changed (1)

File src/android.c

 	struct seapp_context *cur;
 	char *p, *name = NULL, *value = NULL, *saveptr;
 	size_t len;
-	int i = 0, ret;
+	int i = 0, n, ret;
 
 	while ((fp==NULL) && seapp_contexts_file[i])
 		fp = fopen(seapp_contexts_file[i++], "r");
 		return -1;
 	}
 
+	if (seapp_contexts) {
+		for (n = 0; n < nspec; n++) {
+			cur = seapp_contexts[n];
+			free(cur->user);
+			free(cur->seinfo);
+			free(cur->name);
+			free(cur->domain);
+			free(cur->type);
+			free(cur->level);
+			free(cur->sebool);
+		}
+		free(seapp_contexts);
+	}
+
 	nspec = 0;
 	while (fgets(line_buf, sizeof line_buf - 1, fp)) {
 		p = line_buf;