Pino Toscano
2017-Oct-23 15:46 UTC
[Libguestfs] [PATCH] rescue: initialize CLEANUP pointer variable
This way it will not try to free uninitialized memory when going out of
scope, and the inspector mode is not enabled.
Fixes commit 3637c42f4e521eb647d7dfae7f48eb1689d0af54.
---
rescue/escape.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/rescue/escape.c b/rescue/escape.c
index 3bb69578b..a6af99ae1 100644
--- a/rescue/escape.c
+++ b/rescue/escape.c
@@ -236,7 +236,7 @@ print_help (void)
static void
print_inspector (void)
{
- CLEANUP_FREE_STRING_LIST char **roots;
+ CLEANUP_FREE_STRING_LIST char **roots = NULL;
size_t i;
const char *root;
char *str;
--
2.13.6
Richard W.M. Jones
2017-Oct-23 16:50 UTC
Re: [Libguestfs] [PATCH] rescue: initialize CLEANUP pointer variable
On Mon, Oct 23, 2017 at 05:46:24PM +0200, Pino Toscano wrote:> This way it will not try to free uninitialized memory when going out of > scope, and the inspector mode is not enabled. > > Fixes commit 3637c42f4e521eb647d7dfae7f48eb1689d0af54. > --- > rescue/escape.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/rescue/escape.c b/rescue/escape.c > index 3bb69578b..a6af99ae1 100644 > --- a/rescue/escape.c > +++ b/rescue/escape.c > @@ -236,7 +236,7 @@ print_help (void) > static void > print_inspector (void) > { > - CLEANUP_FREE_STRING_LIST char **roots; > + CLEANUP_FREE_STRING_LIST char **roots = NULL; > size_t i; > const char *root; > char *str; > --ACK to both of those virt-rescue patches. I guess we need them in RHEL 7.5 too :-( Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming and virtualization blog: http://rwmj.wordpress.com virt-df lists disk usage of guests without needing to install any software inside the virtual machine. Supports Linux and Windows. http://people.redhat.com/~rjones/virt-df/