* [PATCH] 9p: local: fix memory leak
@ 2019-12-30 2:23 Yan Wang
2019-12-30 8:35 ` Philippe Mathieu-Daudé
2019-12-30 11:34 ` Christian Schoenebeck
0 siblings, 2 replies; 4+ messages in thread
From: Yan Wang @ 2019-12-30 2:23 UTC (permalink / raw)
To: groug; +Cc: qemu-devel
Signed-off-by: Yan Wang <wangyan122@huawei.com>
---
hw/9pfs/9p-local.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/hw/9pfs/9p-local.c b/hw/9pfs/9p-local.c
index ca641390fb..d0592c3b45 100644
--- a/hw/9pfs/9p-local.c
+++ b/hw/9pfs/9p-local.c
@@ -947,7 +947,7 @@ static int local_link(FsContext *ctx, V9fsPath *oldpath,
if (ctx->export_flags & V9FS_SM_MAPPED_FILE &&
local_is_mapped_file_metadata(ctx, name)) {
errno = EINVAL;
- return -1;
+ goto out;
}
odirfd = local_opendir_nofollow(ctx, odirpath);
--
2.19.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] 9p: local: fix memory leak
2019-12-30 2:23 [PATCH] 9p: local: fix memory leak Yan Wang
@ 2019-12-30 8:35 ` Philippe Mathieu-Daudé
2019-12-30 11:34 ` Christian Schoenebeck
1 sibling, 0 replies; 4+ messages in thread
From: Philippe Mathieu-Daudé @ 2019-12-30 8:35 UTC (permalink / raw)
To: Yan Wang, groug; +Cc: qemu-devel
Please describe the memory leak, and if possible how you noticed it.
Indeed the previous 2 calls to g_path_get_dirname() aren't free'd.
On 12/30/19 3:23 AM, Yan Wang wrote:
> Signed-off-by: Yan Wang <wangyan122@huawei.com>
> ---
> hw/9pfs/9p-local.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/hw/9pfs/9p-local.c b/hw/9pfs/9p-local.c
> index ca641390fb..d0592c3b45 100644
> --- a/hw/9pfs/9p-local.c
> +++ b/hw/9pfs/9p-local.c
> @@ -947,7 +947,7 @@ static int local_link(FsContext *ctx, V9fsPath *oldpath,
> if (ctx->export_flags & V9FS_SM_MAPPED_FILE &&
> local_is_mapped_file_metadata(ctx, name)) {
> errno = EINVAL;
> - return -1;
> + goto out;
As the rest of this function... OK.
With some love this function could get clever by only allocating
variables it will use.
With better commit description:
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
> }
>
> odirfd = local_opendir_nofollow(ctx, odirpath);
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] 9p: local: fix memory leak
2019-12-30 2:23 [PATCH] 9p: local: fix memory leak Yan Wang
2019-12-30 8:35 ` Philippe Mathieu-Daudé
@ 2019-12-30 11:34 ` Christian Schoenebeck
2020-01-06 10:54 ` Greg Kurz
1 sibling, 1 reply; 4+ messages in thread
From: Christian Schoenebeck @ 2019-12-30 11:34 UTC (permalink / raw)
To: qemu-devel; +Cc: Yan Wang, Greg Kurz, Philippe Mathieu-Daudé
On Montag, 30. Dezember 2019 03:23:47 CET Yan Wang wrote:
> Signed-off-by: Yan Wang <wangyan122@huawei.com>
> ---
> hw/9pfs/9p-local.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/hw/9pfs/9p-local.c b/hw/9pfs/9p-local.c
> index ca641390fb..d0592c3b45 100644
> --- a/hw/9pfs/9p-local.c
> +++ b/hw/9pfs/9p-local.c
> @@ -947,7 +947,7 @@ static int local_link(FsContext *ctx, V9fsPath *oldpath,
> if (ctx->export_flags & V9FS_SM_MAPPED_FILE &&
> local_is_mapped_file_metadata(ctx, name)) {
> errno = EINVAL;
> - return -1;
> + goto out;
> }
>
> odirfd = local_opendir_nofollow(ctx, odirpath);
This issue was already addressed 10 days ago and is scheduled for merge on
Greg's 9p-next branch:
https://github.com/gkurz/qemu/commit/ac5987075f42e44419a461846fdefde8ab4dd624
https://lists.gnu.org/archive/html/qemu-devel/2019-12/msg04774.html
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] 9p: local: fix memory leak
2019-12-30 11:34 ` Christian Schoenebeck
@ 2020-01-06 10:54 ` Greg Kurz
0 siblings, 0 replies; 4+ messages in thread
From: Greg Kurz @ 2020-01-06 10:54 UTC (permalink / raw)
To: Christian Schoenebeck; +Cc: Philippe Mathieu-Daudé, qemu-devel, Yan Wang
On Mon, 30 Dec 2019 12:34:51 +0100
Christian Schoenebeck <qemu_oss@crudebyte.com> wrote:
> On Montag, 30. Dezember 2019 03:23:47 CET Yan Wang wrote:
> > Signed-off-by: Yan Wang <wangyan122@huawei.com>
> > ---
> > hw/9pfs/9p-local.c | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/hw/9pfs/9p-local.c b/hw/9pfs/9p-local.c
> > index ca641390fb..d0592c3b45 100644
> > --- a/hw/9pfs/9p-local.c
> > +++ b/hw/9pfs/9p-local.c
> > @@ -947,7 +947,7 @@ static int local_link(FsContext *ctx, V9fsPath *oldpath,
> > if (ctx->export_flags & V9FS_SM_MAPPED_FILE &&
> > local_is_mapped_file_metadata(ctx, name)) {
> > errno = EINVAL;
> > - return -1;
> > + goto out;
> > }
> >
> > odirfd = local_opendir_nofollow(ctx, odirpath);
>
> This issue was already addressed 10 days ago and is scheduled for merge on
> Greg's 9p-next branch:
>
> https://github.com/gkurz/qemu/commit/ac5987075f42e44419a461846fdefde8ab4dd624
>
> https://lists.gnu.org/archive/html/qemu-devel/2019-12/msg04774.html
>
>
That's correct.
Philippe,
If the commit description meets your expectations, just tell me and
I'll add your R-b.
Cheers and happy new year,
--
Greg
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2020-01-06 10:55 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-12-30 2:23 [PATCH] 9p: local: fix memory leak Yan Wang
2019-12-30 8:35 ` Philippe Mathieu-Daudé
2019-12-30 11:34 ` Christian Schoenebeck
2020-01-06 10:54 ` Greg Kurz
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.