Initialize history_out always with NULL so apt will not segfault later
authorDavid Kalnischkies <kalnischkies@gmail.com>
Sat, 3 Apr 2010 15:57:41 +0000 (17:57 +0200)
committerDavid Kalnischkies <kalnischkies@gmail.com>
Sat, 3 Apr 2010 15:57:41 +0000 (17:57 +0200)
in the event of a failure in OpenLog() (which will happen if called with
Debug::NoLocking as user)

apt-pkg/deb/dpkgpm.cc

index c0efa7b..14a4968 100644 (file)
@@ -105,7 +105,7 @@ ionice(int PID)
 /* */
 pkgDPkgPM::pkgDPkgPM(pkgDepCache *Cache) 
    : pkgPackageManager(Cache), dpkgbuf_pos(0),
-     term_out(NULL), PackagesDone(0), PackagesTotal(0)
+     term_out(NULL), history_out(NULL), PackagesDone(0), PackagesTotal(0)
 {
 }
                                                                        /*}}}*/
@@ -651,6 +651,7 @@ bool pkgDPkgPM::CloseLog()
       fprintf(history_out, "End-Date: %s\n", timestr);
       fclose(history_out);
    }
+   history_out = NULL;
 
    return true;
 }