Skip to contentSkip to conversation

fix resource leak (on failure path) in sidtab_insert

PATCH New [email protected] 1 participant 1 message Aug 10, 2005 SELinux security module

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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.

avc_sidtab.c +1 -0
Index: 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 [email protected] with the words "unsubscribe selinux" without quotes as the message.