Skip to contentSkip to conversation

mcstransd: fix memory leak in new_context_str

PATCH Applied bauen1 4 participants 4 messages May 12, 2020 – May 13, 2020 SELinux security module

lore
Share & tools
lore

bauen1

author
#0 lore raw

PATCH 1/1 mcstransd: fix memory leak in new_context_str

The return value of context_new needs to be free with context_free.

---
 mcstrans/src/mcstrans.c | 1 +
 1 file changed, 1 insertion(+)
mcstrans/src/mcstrans.c +1 -0
index 96bdbdff..2116b161 100644
@@ -919,6 +919,7 @@ new_context_str(const security_context_t incon, const char *range) {
 	}
 	context_range_set(con, range);
 	rcon = strdup(context_str(con));
+	context_free(con);
 	if (!rcon) {
 		goto exit;
 	}
Signature · 1 line
2.26.2
Acked-by on v1 1/1
#1 lore raw
Quoted 26 lines

-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of bauen1
Sent: Tuesday, May 12, 2020 12:53 PM
To: selinux <[email protected]>
Subject: [PATCH] mcstransd: fix memory leak in new_context_str

The return value of context_new needs to be free with context_free.

---
 mcstrans/src/mcstrans.c | 1 +
 1 file changed, 1 insertion(+)
mcstrans/src/mcstrans.c index renamed from mcstrans/src/mcstrans.c +0 -0

96bdbdff..2116b161 100644

mcstrans/src/mcstrans.c +1 -0
@@ -919,6 +919,7 @@ new_context_str(const security_context_t incon, const
 char *range) {
 	}
 	context_range_set(con, range);
 	rcon = strdup(context_str(con));
+	context_free(con);
 	if (!rcon) {
 		goto exit;
Quoted 3 lines

}
--
2.26.2

#2 lore raw
In reply to bauen1
Quoted 4 lines · On Tue, May 12, 2020 at 07:52:54PM +0200, bauen1 wrote:

The return value of context_new needs to be free with context_free.

Applied.

Quoted 16 lines
---
 mcstrans/src/mcstrans.c | 1 +
 1 file changed, 1 insertion(+)
mcstrans/src/mcstrans.c +1 -0
index 96bdbdff..2116b161 100644
@@ -919,6 +919,7 @@ new_context_str(const security_context_t incon, const char *range) {
 	}
 	context_range_set(con, range);
 	rcon = strdup(context_str(con));
+	context_free(con);
 	if (!rcon) {
 		goto exit;
 	}
Signature · 2 lines
()  ascii ribbon campaign - against html e-mail 
/\  www.asciiribbon.org   - against proprietary attachments
#3 lore raw
Quoted 8 lines · Petr Lautrbach
Quoted 4 lines · On Tue, May 12, 2020 at 07:52:54PM +0200, bauen1 wrote:

The return value of context_new needs to be free with context_free.

Applied.

I updated the state to accepted in Patchwork

Quoted 21 lines
Quoted 10 lines
---
 mcstrans/src/mcstrans.c | 1 +
 1 file changed, 1 insertion(+)
mcstrans/src/mcstrans.c +0 -0
index 96bdbdff..2116b161 100644

mcstrans/src/mcstrans.c new_context_str(const security_context_t incon, const char *range) { · line 925

Quoted 7 lines
mcstrans/src/mcstrans.c +1 -0
@@ -919,6 +919,7 @@ new_context_str(const security_context_t incon, const char *range) {
      }
      context_range_set(con, range);
      rcon = strdup(context_str(con));
+     context_free(con);
      if (!rcon) {
              goto exit;
      }

--
() ascii ribbon campaign - against html e-mail
/\ www.asciiribbon.org - against proprietary attachments