[PATCH] libsepol: Fix valgrind errors in constraint_expr_eval_reason

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

Signed-off-by: Richard Haines <richard_c_haines@xxxxxxxxxxxxxx>
---
 libsepol/src/services.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/libsepol/src/services.c b/libsepol/src/services.c
index 73faa05..6869173 100644
--- a/libsepol/src/services.c
+++ b/libsepol/src/services.c
@@ -723,6 +723,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);
@@ -743,6 +744,7 @@ mls_ops:
 						expr_list[x], b);
 			push(answer_list[answer_counter++]);
 			free(b);
+			free(expr_list[x]);
 		} else {
 			push(expr_list[x]);
 		}
@@ -807,6 +809,8 @@ out:
 		for (x = 0; expr_list[x] != NULL; x++)
 			free(expr_list[x]);
 	}
+	free(answer_list);
+	free(expr_list);
 	return rc;
 }
 
-- 
1.8.3.1


--
This message was distributed to subscribers of the selinux mailing list.
If you no longer wish to subscribe, send mail to majordomo@xxxxxxxxxxxxx with
the words "unsubscribe selinux" without quotes as the message.




[Index of Archives]     [Selinux Refpolicy]     [Linux SGX]     [Fedora Users]     [Fedora Desktop]     [Yosemite Photos]     [Yosemite Camping]     [Yosemite Campsites]     [KDE Users]     [Gnome Users]

  Powered by Linux