depends.c (dbSatisfiesDepend): strdup dbProvCache keys (ALT#23811)
My previous assumption that strdup() was not needed for dbProvCache keys was wrong. The keys point to header memory, which is right. However, those are not only ts->addedPackages and ts->erasedPackages headers. In checkDependent(), headers come from rpmdb and are disposed immediately after the check.
This commit is contained in:
parent
cb105c88c8
commit
c9b1f0e2ec
@ -525,8 +525,7 @@ int dbSatisfiesDepend(rpmTransactionSet ts,
|
||||
/* Update dbProvCache.
|
||||
* When versions did not match, it is still okay to say "yes" for the name. */
|
||||
if (cacheData == NULL)
|
||||
/* XXX keyName points to header memory, no need for strdup */
|
||||
htAddEntry(dbProvCache, keyName, rc < 1 ? "yes" : NULL);
|
||||
htAddEntry(dbProvCache, xstrdup(keyName), rc < 1 ? "yes" : NULL);
|
||||
|
||||
return rc ? 1 : 0;
|
||||
}
|
||||
@ -901,6 +900,6 @@ int rpmdepCheck(rpmTransactionSet ts,
|
||||
exit:
|
||||
ps->problems = _free(ps->problems);
|
||||
ps = _free(ps);
|
||||
dbProvCache = htFree(dbProvCache, NULL, NULL);
|
||||
dbProvCache = htFree(dbProvCache, _free, NULL);
|
||||
return rc;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user