+Thu Aug 29 14:51:35 CDT 2002 Adam Heath <doogie@debian.org>
+
+ * lib/dbmodify.c, lib/dump.c, lib/lock.c, lib/startup.c, lib/tarfn.c
+ main/configure.c, main/filesdb.c, main/query.c: Fix several minor
+ memleaks.
+
Thu Aug 29 14:42:05 CDT 2002 Adam Heath <doogie@debian.org>
* lib/parsehelp.c: Fix corruption of available file, caused by use of
stanza, and process them all. Closes: #147492.
* Fix corruption of available file, caused by use of memory that was
previously freed. Closes: #154257.
+ * Fix several minor memleaks.
-- Adam Heath <doogie@debian.org> UNRELEASED
break;
}
+ free(statusfile);
+ free(availablefile);
+ free(importanttmpfile);
free(updatefnbuf);
}
which, pigp->name, filename);
varbufreset(&vb);
}
+ iterpkgend(it);
varbuffree(&vb);
if (mustsync) {
if (fflush(file))
#include <dpkg.h>
#include <dpkg-db.h>
-static char *dblockfile= NULL;
static int dblockfd= -1;
static void cu_unlockdb(int argc, void **argv) {
struct flock fl;
- assert(dblockfile);
assert(dblockfd >= 0);
fl.l_type= F_UNLCK;
fl.l_whence= SEEK_SET;
void lockdatabase(const char *admindir) {
int n;
struct flock fl;
+ char *dblockfile= NULL;
- if (!dblockfile) {
n= strlen(admindir);
dblockfile= m_malloc(n+sizeof(LOCKFILE)+2);
strcpy(dblockfile,admindir);
strcpy(dblockfile+n, "/" LOCKFILE);
- }
if (dblockfd == -1) {
dblockfd= open(dblockfile, O_RDWR|O_CREAT|O_TRUNC, 0660);
if (dblockfd == -1) {
ohshite(_("unable to lock dpkg status database"));
}
setcloexec(dblockfd, dblockfile);
+ free(dblockfile);
push_cleanup(cu_unlockdb,~0, NULL,0, 0);
}
void standard_shutdown(void) {
set_error_display(0,0);
error_unwind(ehflag_normaltidy);
+ nffreeall();
}
free(symListPointer);
symListPointer = symListBottom;
}
+ free(symListPointer);
if ( status > 0 ) { /* Read partial header record */
errno = 0; /* Indicates broken tarfile */
return -1;
char *currenthash= 0, *newdisthash= 0;
struct stat stab;
enum conffopt what;
+ static const char *EMPTY_HASH = "-";
if (pkg->status == stat_notinstalled)
ohshit(_("no package named `%s' is installed, cannot configure"),pkg->name);
for (conff= pkg->installed.conffiles; conff; conff= conff->next) {
r= conffderef(pkg, &cdr, conff->name);
if (r == -1) {
- conff->hash= nfstrsave("-");
+ conff->hash= EMPTY_HASH;
continue;
}
md5hash(pkg,¤thash,cdr.buf);
diversions= oicontest;
}
if (ferror(file)) ohshite(_("read error in diversions [i]"));
+ fclose(file);
onerr_abort--;
}
}
if (ferror(stdout)) werr("stdout");
if (ferror(stderr)) werr("stderr");
+ modstatdb_shutdown();
}
static int searchoutput(struct filenamenode *namenode) {
if (ferror(stdout)) werr("stdout");
}
}
+ modstatdb_shutdown();
}
void enqperpackage(const char *const *argv) {
"and dpkg --contents (= dpkg-deb --contents) to list their contents.\n"),stderr);
if (ferror(stdout)) werr("stdout");
}
+ modstatdb_shutdown();
}
void showpackages(const char *const *argv) {
if (ferror(stdout)) werr("stdout");
if (ferror(stderr)) werr("stderr");
freeformat(fmt);
+ modstatdb_shutdown();
}
static void printversion(void) {