All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] mcstransd: fix memory leak in new_context_str
@ 2020-05-12 17:52 bauen1
  2020-05-12 18:03 ` Roberts, William C
  2020-05-13 15:12 ` Petr Lautrbach
  0 siblings, 2 replies; 4+ messages in thread
From: bauen1 @ 2020-05-12 17:52 UTC (permalink / raw)
  To: selinux

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

Signed-off-by: bauen1 <j2468h@gmail.com>
---
 mcstrans/src/mcstrans.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/mcstrans/src/mcstrans.c b/mcstrans/src/mcstrans.c
index 96bdbdff..2116b161 100644
--- a/mcstrans/src/mcstrans.c
+++ b/mcstrans/src/mcstrans.c
@@ -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;
 	}
-- 
2.26.2


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

* RE: [PATCH] mcstransd: fix memory leak in new_context_str
  2020-05-12 17:52 [PATCH] mcstransd: fix memory leak in new_context_str bauen1
@ 2020-05-12 18:03 ` Roberts, William C
  2020-05-13 15:12 ` Petr Lautrbach
  1 sibling, 0 replies; 4+ messages in thread
From: Roberts, William C @ 2020-05-12 18:03 UTC (permalink / raw)
  To: bauen1, selinux

> -----Original Message-----
> From: selinux-owner@vger.kernel.org [mailto:selinux-owner@vger.kernel.org]
> On Behalf Of bauen1
> Sent: Tuesday, May 12, 2020 12:53 PM
> To: selinux <selinux@vger.kernel.org>
> Subject: [PATCH] mcstransd: fix memory leak in new_context_str
> 
> The return value of context_new needs to be free with context_free.
> 
> Signed-off-by: bauen1 <j2468h@gmail.com>
> ---
>  mcstrans/src/mcstrans.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/mcstrans/src/mcstrans.c b/mcstrans/src/mcstrans.c index
> 96bdbdff..2116b161 100644
> --- a/mcstrans/src/mcstrans.c
> +++ b/mcstrans/src/mcstrans.c
> @@ -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;
>  	}
> --
> 2.26.2

Acked-by: William Roberts <william.c.roberts@intel.com>

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

* Re: [PATCH] mcstransd: fix memory leak in new_context_str
  2020-05-12 17:52 [PATCH] mcstransd: fix memory leak in new_context_str bauen1
  2020-05-12 18:03 ` Roberts, William C
@ 2020-05-13 15:12 ` Petr Lautrbach
  2020-05-13 15:52   ` William Roberts
  1 sibling, 1 reply; 4+ messages in thread
From: Petr Lautrbach @ 2020-05-13 15:12 UTC (permalink / raw)
  To: selinux; +Cc: bauen1, William Roberts

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

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.
> 
> Signed-off-by: bauen1 <j2468h@gmail.com>
> Acked-by: William Roberts <william.c.roberts@intel.com>

Applied.

> ---
>  mcstrans/src/mcstrans.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/mcstrans/src/mcstrans.c b/mcstrans/src/mcstrans.c
> index 96bdbdff..2116b161 100644
> --- a/mcstrans/src/mcstrans.c
> +++ b/mcstrans/src/mcstrans.c
> @@ -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

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

* Re: [PATCH] mcstransd: fix memory leak in new_context_str
  2020-05-13 15:12 ` Petr Lautrbach
@ 2020-05-13 15:52   ` William Roberts
  0 siblings, 0 replies; 4+ messages in thread
From: William Roberts @ 2020-05-13 15:52 UTC (permalink / raw)
  To: Petr Lautrbach; +Cc: selinux, bauen1, William Roberts

On Wed, May 13, 2020 at 10:13 AM Petr Lautrbach <plautrba@redhat.com> wrote:
>
> 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.
> >
> > Signed-off-by: bauen1 <j2468h@gmail.com>
> > Acked-by: William Roberts <william.c.roberts@intel.com>
>
> Applied.

I updated the state to accepted in Patchwork

>
> > ---
> >  mcstrans/src/mcstrans.c | 1 +
> >  1 file changed, 1 insertion(+)
> >
> > diff --git a/mcstrans/src/mcstrans.c b/mcstrans/src/mcstrans.c
> > index 96bdbdff..2116b161 100644
> > --- a/mcstrans/src/mcstrans.c
> > +++ b/mcstrans/src/mcstrans.c
> > @@ -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

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

end of thread, other threads:[~2020-05-13 15:53 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-12 17:52 [PATCH] mcstransd: fix memory leak in new_context_str bauen1
2020-05-12 18:03 ` Roberts, William C
2020-05-13 15:12 ` Petr Lautrbach
2020-05-13 15:52   ` William Roberts

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.