aboutsummaryrefslogtreecommitdiff
path: root/usr.sbin/pkg_install/lib
diff options
context:
space:
mode:
authorMaxim Sobolev <sobomax@FreeBSD.org>2001-07-20 13:20:32 +0000
committerMaxim Sobolev <sobomax@FreeBSD.org>2001-07-20 13:20:32 +0000
commita153062b97837f91bcf2db6bebb94f2d9edadc10 (patch)
tree55e0dc6a5c307dfe265512caf27530601b955935 /usr.sbin/pkg_install/lib
parent4dbf3ccb9b09c57c3790b6ad53b75b3f4430d21c (diff)
Notes
Diffstat (limited to 'usr.sbin/pkg_install/lib')
-rw-r--r--usr.sbin/pkg_install/lib/match.c11
1 files changed, 4 insertions, 7 deletions
diff --git a/usr.sbin/pkg_install/lib/match.c b/usr.sbin/pkg_install/lib/match.c
index f3dc99901351..4128e07d3b29 100644
--- a/usr.sbin/pkg_install/lib/match.c
+++ b/usr.sbin/pkg_install/lib/match.c
@@ -204,18 +204,15 @@ rex_match(char *pattern, char *pkgname)
static int
storeappend(struct store *store, const char *item)
{
- char **tmp;
-
if (store->used + 2 > store->currlen) {
- tmp = store->store;
store->currlen += 16;
- store->store = malloc(store->currlen * sizeof(*(store->store)));
+ store->store = reallocf(store->store,
+ store->currlen * sizeof(*(store->store)));
if (store->store == NULL) {
- warnx("%s(): malloc() failed", __FUNCTION__);
+ store->currlen = 0;
+ warnx("%s(): reallocf() failed", __FUNCTION__);
return 1;
}
- memcpy(store->store, tmp, store->used * sizeof(*(store->store)));
- free(tmp);
}
asprintf(&(store->store[store->used]), "%s", item);