summaryrefslogtreecommitdiff
path: root/apt-pkg/deb/deblistparser.cc
diff options
context:
space:
mode:
authorDavid Kalnischkies <kalnischkies@gmail.com>2012-06-16 19:55:43 +0200
committerDavid Kalnischkies <kalnischkies@gmail.com>2012-06-16 19:55:43 +0200
commit2b803d4069e1f05d0461fbad004482ff02100812 (patch)
treeb30b90c27dd363de7e8fd83432ed7a54eefada0f /apt-pkg/deb/deblistparser.cc
parentef5dc12ccb6964a52c7c7674d2eff98435089d92 (diff)
do not dereference the storage for the unique strings as the pointer can
change at the time of writing the strings, so first store it temporary and then save the index in the (possibily new) pointer location
Diffstat (limited to 'apt-pkg/deb/deblistparser.cc')
-rw-r--r--apt-pkg/deb/deblistparser.cc16
1 files changed, 9 insertions, 7 deletions
diff --git a/apt-pkg/deb/deblistparser.cc b/apt-pkg/deb/deblistparser.cc
index efb76ef54..e93e51af3 100644
--- a/apt-pkg/deb/deblistparser.cc
+++ b/apt-pkg/deb/deblistparser.cc
@@ -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;
}
}