]> git.saurik.com Git - apt.git/blobdiff - apt-pkg/pkgcachegen.cc
cppcheck is right that the check for preventing null deference of Query
[apt.git] / apt-pkg / pkgcachegen.cc
index efd764b517efd43431b9f98634385ab9ad8bdc0d..2bfb776095f4a1deda5190d2a073bf450eb209dd 100644 (file)
@@ -636,7 +636,9 @@ bool pkgCacheGenerator::FinishCache(OpProgress *Progress)
            Dynamic<pkgCache::VerIterator> DynV(V);
            for (; V.end() != true; V++)
            {
-              char const * const Arch = P.Arch();
+               // copy P.Arch() into a string here as a cache remap
+               // in NewDepends() later may alter the pointer location
+              string Arch = P.Arch() == NULL ? "" : P.Arch();
               map_ptrloc *OldDepLast = NULL;
               /* MultiArch handling introduces a lot of implicit Dependencies:
                - MultiArch: same → Co-Installable if they have the same version