2011/4/29 Eric Blake <eblake@xxxxxxxxxx>: > * bootstrap.conf (gnulib_modules): Add getcwd-lgpl. > * tests/commandtest.c (checkoutput): Drop unused cwd. > * tests/commandhelper.c (main): Let getcwd malloc. > * tests/testutils.c (virTestMain): Likewise. > * tools/virsh.c (cmdPwd): Likewise. > (virshCmds): Expose cmdPwd and cmdCd on mingw. > --- > >> Oh, and now that gnulib getcwd-lgpl exists, we could use it >> to fix our uses of getcwd(NULL,0), followup coming later. > > Âbootstrap.conf    Â|  Â1 + > Âtests/commandhelper.c |  Â7 ++++--- > Âtests/commandtest.c  |  Â4 ---- > Âtests/testutils.c   |  Â3 +-- > Âtools/virsh.c     |  34 ++++++++-------------------------- > Â5 files changed, 14 insertions(+), 35 deletions(-) > diff --git a/tests/testutils.c b/tests/testutils.c > index 456a735..91035a2 100644 > --- a/tests/testutils.c > +++ b/tests/testutils.c > @@ -478,7 +478,6 @@ int virtTestMain(int argc, >         Âint (*func)(void)) > Â{ >   int ret; > -  Âchar cwd[PATH_MAX]; > Â#if TEST_OOM >   int approxAlloc = 0; >   int n; > @@ -491,7 +490,7 @@ int virtTestMain(int argc, > >   abs_srcdir = getenv("abs_srcdir"); >   if (!abs_srcdir) > -    Âabs_srcdir = getcwd(cwd, sizeof(cwd)); > +    Âabs_srcdir = getcwd(NULL, 0); >   if (!abs_srcdir) >     exit(EXIT_AM_HARDFAIL); Now you have created a memory leak (not a critical one, that's true), because abs_srcdir can be malloc'ed and you missed to free it. ACK, with that memory leak fixed. Matthias -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list