summaryrefslogtreecommitdiff
path: root/lib/libalpm/handle.h
diff options
context:
space:
mode:
authorDan McGee <dan@archlinux.org>2011-10-26 15:44:55 -0500
committerDan McGee <dan@archlinux.org>2011-10-26 15:44:55 -0500
commit7a6b01d46c1da385dd34466e757beafa33e02afa (patch)
tree4594f93c0b362ccff0c38527f910b496f401fd9a /lib/libalpm/handle.h
parent2da59e1aa91fa4160ec1c8ec84d94d8141b2a832 (diff)
downloadpacman-7a6b01d46c1da385dd34466e757beafa33e02afa.tar.xz
Don't realloc a 0-length files array when loading packages
There is some pecular behavior going on here when a package is loaded that has no files, as is very common in our test suite. When we enter the realloc/sort code, a package without files will call the following: files = realloc(NULL, 0); One would assume this is a no-op, returning a NULL pointer, but that is not the case and valgrind later reports we are leaking memory. Fix the whole thing by skipping the reallocation and sort steps if the pointer is NULL, as we have nothing to do. Note that the package still gets marked as 'files loaded', becuase although there were none, we tried and were successful. Signed-off-by: Dan McGee <dan@archlinux.org>
Diffstat (limited to 'lib/libalpm/handle.h')
0 files changed, 0 insertions, 0 deletions