+Tue Sep 3 18:40:08 CDT 2002 Adam Heath <doogie@debian.org>
+
+ * lib/dbmodify.c: Fix double free in modstatdb_init, in the case that
+ modstatdb_shutdown was called previously.
+
Tue Sep 3 18:37:45 CDT 2002 Adam Heath <doogie@debian.org>
* lib/nfmalloc.c: Protect duplicate calls to obstack_free(),
dpkg (1.10.7) unstable; urgency=low
+ * Fix double free in modstatdb_init, in the case that modstatdb_shutdown
+ was called previously. Closes: #159515.
+
-- Adam Heath <doogie@debian.org> UNRELEASED
dpkg (1.10.6) unstable; urgency=low
onerr_abort--;
}
+const struct fni { const char *suffix; char **store; } fnis[]= {
+ { STATUSFILE, &statusfile },
+ { AVAILFILE, &availablefile },
+ { UPDATESDIR IMPORTANTTMP, &importanttmpfile },
+ { NULL, NULL }
+};
+
enum modstatdb_rw modstatdb_init(const char *adir, enum modstatdb_rw readwritereq) {
- static const struct fni { const char *suffix; char **store; } fnis[]= {
- { STATUSFILE, &statusfile },
- { AVAILFILE, &availablefile },
- { UPDATESDIR IMPORTANTTMP, &importanttmpfile },
- { NULL, NULL }
- }, *fnip;
+ const struct fni *fnip;
admindir= adir;
}
void modstatdb_shutdown(void) {
+ const struct fni *fnip;
switch (cstatus) {
case msdbrw_write:
checkpoint();
break;
}
- free(statusfile);
- free(availablefile);
- free(importanttmpfile);
+ for (fnip=fnis; fnip->suffix; fnip++) {
+ free(*fnip->store);
+ *fnip->store= NULL;
+ }
free(updatefnbuf);
}