]> git.saurik.com Git - apt.git/blobdiff - apt-pkg/sourcelist.cc
fix memory leaks reported by -fsanitize
[apt.git] / apt-pkg / sourcelist.cc
index 7170e8b5ba4ab1f81fdd056b6a9d3f44dc4aee65..99b64651390f81ddff9c274b5131bb0c5e87f827 100644 (file)
@@ -236,11 +236,11 @@ bool pkgSourceList::Type::ParseLine(vector<metaIndex *> &List,
 // SourceList::pkgSourceList - Constructors                            /*{{{*/
 // ---------------------------------------------------------------------
 /* */
 // SourceList::pkgSourceList - Constructors                            /*{{{*/
 // ---------------------------------------------------------------------
 /* */
-pkgSourceList::pkgSourceList()
+pkgSourceList::pkgSourceList() : d(NULL)
 {
 }
 
 {
 }
 
-pkgSourceList::pkgSourceList(string File)
+pkgSourceList::pkgSourceList(string File) : d(NULL)
 {
    Read(File);
 }
 {
    Read(File);
 }
@@ -331,7 +331,7 @@ bool pkgSourceList::ParseFileOldStyle(string File)
 {
    // Open the stream for reading
    ifstream F(File.c_str(),ios::in /*| ios::nocreate*/);
 {
    // Open the stream for reading
    ifstream F(File.c_str(),ios::in /*| ios::nocreate*/);
-   if (!F != 0)
+   if (F.fail() == true)
       return _error->Errno("ifstream::ifstream",_("Opening %s"),File.c_str());
 
    // CNC:2003-12-10 - 300 is too short.
       return _error->Errno("ifstream::ifstream",_("Opening %s"),File.c_str());
 
    // CNC:2003-12-10 - 300 is too short.