All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jason Tang <jtang@tresys.com>
To: selinux@tycho.nsa.gov
Subject: memory leak in services.c
Date: Fri, 26 Aug 2005 13:13:47 -0400	[thread overview]
Message-ID: <1125076427.5306.19.camel@localhost.localdomain> (raw)

[-- 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;
 }

             reply	other threads:[~2005-08-26 17:13 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-08-26 17:13 Jason Tang [this message]
2005-08-26 18:15 ` memory leak in services.c Stephen Smalley

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1125076427.5306.19.camel@localhost.localdomain \
    --to=jtang@tresys.com \
    --cc=selinux@tycho.nsa.gov \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.