]> git.saurik.com Git - apt.git/commitdiff
do not dereference the storage for the unique strings as the pointer can
authorDavid Kalnischkies <kalnischkies@gmail.com>
Sat, 16 Jun 2012 17:55:43 +0000 (19:55 +0200)
committerDavid Kalnischkies <kalnischkies@gmail.com>
Sat, 16 Jun 2012 17:55:43 +0000 (19:55 +0200)
change at the time of writing the strings, so first store it temporary
and then save the index in the (possibily new) pointer location

apt-pkg/deb/debindexfile.cc
apt-pkg/deb/deblistparser.cc
apt-pkg/edsp/edspindexfile.cc

index 76c74034148dd55539f8656ea319b20b1d03c6d4..de645bb6e331c1189bd9924f68838f39472adcf8 100644 (file)
@@ -602,7 +602,8 @@ bool debStatusIndex::Merge(pkgCacheGenerator &Gen,OpProgress *Prog) const
    pkgCache::PkgFileIterator CFile = Gen.GetCurFile();
    CFile->Size = Pkg.FileSize();
    CFile->mtime = Pkg.ModificationTime();
-   CFile->Archive = Gen.WriteUniqString("now");
+   map_ptrloc const storage = Gen.WriteUniqString("now");
+   CFile->Archive = storage;
    
    if (Gen.MergeList(Parser) == false)
       return _error->Error("Problem with MergeList %s",File.c_str());   
index efb76ef54795ae0833676b43a733cc13ad869307..e93e51af30dbb5c6ba1b84f6a1887a880e85dd9c 100644 (file)
@@ -782,7 +782,8 @@ bool debListParser::LoadReleaseInfo(pkgCache::PkgFileIterator &FileI,
 {
    // apt-secure does no longer download individual (per-section) Release
    // file. to provide Component pinning we use the section name now
-   FileI->Component = WriteUniqString(component);
+   map_ptrloc const storage = WriteUniqString(component);
+   FileI->Component = storage;
 
    // FIXME: Code depends on the fact that Release files aren't compressed
    FILE* release = fdopen(dup(File.Fd()), "r");
@@ -869,13 +870,14 @@ bool debListParser::LoadReleaseInfo(pkgCache::PkgFileIterator &FileI,
               break;
            *s = '\0';
         }
+        map_ptrloc const storage = WriteUniqString(data);
         switch (writeTo) {
-        case Suite: FileI->Archive = WriteUniqString(data); break;
-        case Component: FileI->Component = WriteUniqString(data); break;
-        case Version: FileI->Version = WriteUniqString(data); break;
-        case Origin: FileI->Origin = WriteUniqString(data); break;
-        case Codename: FileI->Codename = WriteUniqString(data); break;
-        case Label: FileI->Label = WriteUniqString(data); break;
+        case Suite: FileI->Archive = storage; break;
+        case Component: FileI->Component = storage; break;
+        case Version: FileI->Version = storage; break;
+        case Origin: FileI->Origin = storage; break;
+        case Codename: FileI->Codename = storage; break;
+        case Label: FileI->Label = storage; break;
         case None: break;
         }
       }
index 482581979f4cc9c87f448287bef538d30fecc577..98ce4497ae62d560c40c6da18a04ca52c055b512 100644 (file)
@@ -51,7 +51,8 @@ bool edspIndex::Merge(pkgCacheGenerator &Gen,OpProgress *Prog) const
    pkgCache::PkgFileIterator CFile = Gen.GetCurFile();
    CFile->Size = Pkg.FileSize();
    CFile->mtime = Pkg.ModificationTime();
-   CFile->Archive = Gen.WriteUniqString("edsp::scenario");
+   map_ptrloc const storage = Gen.WriteUniqString("edsp::scenario");
+   CFile->Archive = storage;
 
    if (Gen.MergeList(Parser) == false)
       return _error->Error("Problem with MergeList %s",File.c_str());