RPM Community Forums

Mailing List Message of <rpm-cvs>

[CVS] RPM: rpm/rpmio/ rpmlua.c

From: Ralf S. Engelschall <rse@rpm5.org>
Date: Thu 19 Jul 2007 - 08:38:07 CEST
Message-Id: <20070719063807.18B3B3484F5@rpm5.org>
  RPM Package Manager, CVS Repository
  http://rpm5.org/cvs/
  ____________________________________________________________________________

  Server: rpm5.org                         Name:   Ralf S. Engelschall
  Root:   /v/rpm/cvs                       Email:  rse@rpm5.org
  Module: rpm                              Date:   19-Jul-2007 08:38:07
  Branch: HEAD                             Handle: 2007071907380600

  Modified files:
    rpm/rpmio               rpmlua.c

  Log:
    lua->printbuf can be NULL and caused a free(NULL) run-time problem
    for me. Solve by consistently use the usual _free() usage in rpmlua.c
    similar to what is done in the remaining RPM code.

  Summary:
    Revision    Changes     Path
    2.19        +5  -6      rpm/rpmio/rpmlua.c
  ____________________________________________________________________________

  patch -p0 <<'@@ .'
  Index: rpm/rpmio/rpmlua.c
  ============================================================================
  $ cvs diff -u -r2.18 -r2.19 rpmlua.c
  --- rpm/rpmio/rpmlua.c	16 Jul 2007 08:49:04 -0000	2.18
  +++ rpm/rpmio/rpmlua.c	19 Jul 2007 06:38:06 -0000	2.19
  @@ -114,8 +114,8 @@
   /*@=branchstate@*/
       if (lua) {
   	if (lua->L) lua_close(lua->L);
  -	free(lua->printbuf);
  -	free(lua);
  +	lua->printbuf = _free(lua->printbuf);
  +	lua = _free(lua);
       }
       return NULL;
   }
  @@ -160,8 +160,7 @@
   {
       INITSTATE(_lua, lua);
       lua->storeprint = flag;
  -    free(lua->printbuf);
  -    lua->printbuf = NULL;
  +    lua->printbuf = _free(lua->printbuf);
       lua->printbufsize = 0;
   }
   
  @@ -367,7 +366,7 @@
   
   void *rpmluavFree(rpmluav var)
   {
  -    free(var);
  +    var = _free(var);
       return NULL;
   }
   
  @@ -785,7 +784,7 @@
   /*@-compdef -kepttrans -usereleased @*/
   	args->argt = argt;
   	rpmhookCallArgs(name, args);
  -	free(argt);
  +	argt = _free(argt);
   	(void) rpmhookArgsFree(args);
   /*@=compdef =kepttrans =usereleased @*/
       }
  @@ .
Received on Thu Jul 19 08:38:07 2007
Driven by Jeff Johnson and the RPM project team.
Hosted by OpenPKG and Ralf S. Engelschall.
Powered by FreeBSD and OpenPKG.