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

[PATCH] fix resource leak (on failure path) in sidtab_insert


This patch fixes a trivial bug found in avc_sidtab.c by Coverity:

	When the newctx malloc fails in sidtab_insert(), newnode,
	which was previously malloced, is never freed.

Index: src/avc_sidtab.c
===================================================================
--- src.orig/avc_sidtab.c
+++ src/avc_sidtab.c
@@ -58,6 +58,7 @@ sidtab_insert(struct sidtab *s, security
 	newctx = (security_context_t)strdup(ctx);
 	if (!newctx) {
 		rc = -1;
+		avc_free(newnode);
 		goto out;
 	}
 

--
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.


This mailing list archive is a service of Copilot Consulting.