Message ID | 20171006235023.11952-64-f4bug@amsat.org |
---|---|
State | New |
Headers | show |
Series | use g_new() family of functions | expand |
On 07.10.2017 01:49, Philippe Mathieu-Daudé wrote: > Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> > --- > Kamil are you interested in maintaining bsd-user? :) > Long term yes, short term I'm occupied full-time on getting modern debuggers as fully-functional and as fully-featured on NetBSD as possible. ( http://blog.netbsd.org/tnf/entry/eurobsdcon_2017_paris_report ) > bsd-user/syscall.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/bsd-user/syscall.c b/bsd-user/syscall.c > index 66492aaf5d..9120cea61e 100644 > --- a/bsd-user/syscall.c > +++ b/bsd-user/syscall.c > @@ -227,7 +227,7 @@ static abi_long do_freebsd_sysctl(abi_ulong namep, int32_t namelen, abi_ulong ol > void *hnamep, *holdp, *hnewp = NULL; > size_t holdlen; > abi_ulong oldlen = 0; > - int32_t *snamep = g_malloc(sizeof(int32_t) * namelen), *p, *q, i; > + int32_t *snamep, *p, *q, i; > uint32_t kind = 0; > > if (oldlenp) > @@ -239,6 +239,7 @@ static abi_long do_freebsd_sysctl(abi_ulong namep, int32_t namelen, abi_ulong ol > if (!(holdp = lock_user(VERIFY_WRITE, oldp, oldlen, 0))) > return -TARGET_EFAULT; > holdlen = oldlen; > + snamep = g_new(int32_t, namelen); > for (p = hnamep, q = snamep, i = 0; i < namelen; p++, i++) > *q++ = tswap32(*p); > oidfmt(snamep, namelen, NULL, &kind); >
Hi Michael, Since there is no bsd-user maintainers, can you take this single patch for 2.11? It fixes a memory leak. Regards, Phil. On 10/06/2017 08:49 PM, Philippe Mathieu-Daudé wrote: > Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> > --- > Kamil are you interested in maintaining bsd-user? :) > > bsd-user/syscall.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/bsd-user/syscall.c b/bsd-user/syscall.c > index 66492aaf5d..9120cea61e 100644 > --- a/bsd-user/syscall.c > +++ b/bsd-user/syscall.c > @@ -227,7 +227,7 @@ static abi_long do_freebsd_sysctl(abi_ulong namep, int32_t namelen, abi_ulong ol > void *hnamep, *holdp, *hnewp = NULL; > size_t holdlen; > abi_ulong oldlen = 0; > - int32_t *snamep = g_malloc(sizeof(int32_t) * namelen), *p, *q, i; > + int32_t *snamep, *p, *q, i; > uint32_t kind = 0; > > if (oldlenp) > @@ -239,6 +239,7 @@ static abi_long do_freebsd_sysctl(abi_ulong namep, int32_t namelen, abi_ulong ol > if (!(holdp = lock_user(VERIFY_WRITE, oldp, oldlen, 0))) > return -TARGET_EFAULT; > holdlen = oldlen; > + snamep = g_new(int32_t, namelen); > for (p = hnamep, q = snamep, i = 0; i < namelen; p++, i++) > *q++ = tswap32(*p); > oidfmt(snamep, namelen, NULL, &kind); >
diff --git a/bsd-user/syscall.c b/bsd-user/syscall.c index 66492aaf5d..9120cea61e 100644 --- a/bsd-user/syscall.c +++ b/bsd-user/syscall.c @@ -227,7 +227,7 @@ static abi_long do_freebsd_sysctl(abi_ulong namep, int32_t namelen, abi_ulong ol void *hnamep, *holdp, *hnewp = NULL; size_t holdlen; abi_ulong oldlen = 0; - int32_t *snamep = g_malloc(sizeof(int32_t) * namelen), *p, *q, i; + int32_t *snamep, *p, *q, i; uint32_t kind = 0; if (oldlenp) @@ -239,6 +239,7 @@ static abi_long do_freebsd_sysctl(abi_ulong namep, int32_t namelen, abi_ulong ol if (!(holdp = lock_user(VERIFY_WRITE, oldp, oldlen, 0))) return -TARGET_EFAULT; holdlen = oldlen; + snamep = g_new(int32_t, namelen); for (p = hnamep, q = snamep, i = 0; i < namelen; p++, i++) *q++ = tswap32(*p); oidfmt(snamep, namelen, NULL, &kind);
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> --- Kamil are you interested in maintaining bsd-user? :) bsd-user/syscall.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)