All of lore.kernel.org
 help / color / mirror / Atom feed
* memory leak in services.c
@ 2005-08-26 17:13 Jason Tang
  2005-08-26 18:15 ` Stephen Smalley
  0 siblings, 1 reply; 2+ messages in thread
From: Jason Tang @ 2005-08-26 17:13 UTC (permalink / raw)
  To: selinux

[-- Attachment #1: Type: text/plain, Size: 191 bytes --]

The following patch corrects a memory leak in sepol_context_to_sid()
within libsepol/services.c.  The context was malloc()ed but never
free()ed afterwards.

-- 
Jason Tang / jtang@tresys.com

[-- Attachment #2: patch-memleak --]
[-- Type: text/plain, Size: 466 bytes --]

--- services.c-old	2005-08-26 12:19:01.000000000 -0400
+++ services.c	2005-08-26 12:18:18.000000000 -0400
@@ -548,11 +548,14 @@ int sepol_context_to_sid(sepol_security_
 		goto err;		
 
 	context_destroy(context);
+        free(context);
 	return STATUS_SUCCESS;
 
 	err:
-	if (context)
+	if (context) {
 		context_destroy(context);
+                free(context);
+        }
 	DEBUG(__FUNCTION__, "could not convert %s to sid\n", scontext);
 	return STATUS_ERR;
 }

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2005-08-26 18:15 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-08-26 17:13 memory leak in services.c Jason Tang
2005-08-26 18:15 ` Stephen Smalley

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.