Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/lib/libalpm/be_local.c
diff options
context:
space:
mode:
authorDaniel Micay <danielmicay@gmail.com>2015-01-14 07:21:29 -0500
committerAllan McRae <allan@archlinux.org>2015-01-21 14:26:54 +1000
commit21281e9b69fa061bb64b6fb4e25f04bd0e530554 (patch)
treeff33426094a3f32b8d93dd6328f562c00ff22e14 /lib/libalpm/be_local.c
parenta31426d3ea79f7b22d5000f2bfecb52f95246444 (diff)
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>
Diffstat (limited to 'lib/libalpm/be_local.c')
-rw-r--r--lib/libalpm/be_local.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/libalpm/be_local.c b/lib/libalpm/be_local.c
index 93763966..7d141c6d 100644
--- a/lib/libalpm/be_local.c
+++ b/lib/libalpm/be_local.c
@@ -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,