1
0
mirror of https://github.com/moparisthebest/pacman synced 2024-08-13 17:03:46 -04:00

be_local: fix _alpm_greedy_grow usage

The files_size variable contains the current capacity (in bytes) and
should not be used to calculate the next length increment. It only works
because _alpm_greedy_grow currently results in incremental growth.

Signed-off-by: Daniel Micay <danielmicay@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
This commit is contained in:
Daniel Micay 2015-01-14 07:21:29 -05:00 committed by Allan McRae
parent a31426d3ea
commit 21281e9b69

View File

@ -780,7 +780,7 @@ static int local_db_read(alpm_pkg_t *info, alpm_dbinfrq_t inforeq)
while(safe_fgets(line, sizeof(line), fp) &&
(len = _alpm_strip_newline(line, 0))) {
if(!_alpm_greedy_grow((void **)&files, &files_size,
(files_size ? files_size + sizeof(alpm_file_t) : 8 * sizeof(alpm_file_t)))) {
(files_count ? (files_count + 1) * sizeof(alpm_file_t) : 8 * sizeof(alpm_file_t)))) {
goto error;
}
/* since we know the length of the file string already,