diff options
author | Jindrich Novy <jnovy@redhat.com> | 2008-04-28 13:41:45 +0200 |
---|---|---|
committer | Jindrich Novy <jnovy@redhat.com> | 2008-04-28 13:43:08 +0200 |
commit | 75a21293916e7b93b5059045a254ab8bb3ecc96f (patch) | |
tree | b19bd85bfe19617601982ad904ecac37b204e6af /rpmdb | |
parent | c729f98edf54306501096b7f45c55ca1f96373f0 (diff) | |
download | rpm-75a21293916e7b93b5059045a254ab8bb3ecc96f.tar.gz rpm-75a21293916e7b93b5059045a254ab8bb3ecc96f.tar.bz2 rpm-75a21293916e7b93b5059045a254ab8bb3ecc96f.zip |
Remove remaining alloca() from rpmdb.c
Diffstat (limited to 'rpmdb')
-rw-r--r-- | rpmdb/rpmdb.c | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/rpmdb/rpmdb.c b/rpmdb/rpmdb.c index afb4535e1..ff4a8680d 100644 --- a/rpmdb/rpmdb.c +++ b/rpmdb/rpmdb.c @@ -1366,7 +1366,7 @@ static rpmRC dbiFindByLabel(dbiIndex dbi, DBC * dbcursor, DBT * key, DBT * data, *matches = dbiFreeIndexSet(*matches); /* maybe a name and a release */ - localarg = alloca(strlen(arg) + 1); + localarg = xmalloc(strlen(arg) + 1); s = stpcpy(localarg, arg); c = '\0'; @@ -1386,11 +1386,14 @@ static rpmRC dbiFindByLabel(dbiIndex dbi, DBC * dbcursor, DBT * key, DBT * data, } /* FIX: *matches may be NULL. */ - if (s == localarg) return RPMRC_NOTFOUND; + if (s == localarg) { + rc = RPMRC_NOTFOUND; + goto exit; + } *s = '\0'; rc = dbiFindMatches(dbi, dbcursor, key, data, localarg, s + 1, NULL, matches); - if (rc != RPMRC_NOTFOUND) return rc; + if (rc != RPMRC_NOTFOUND) goto exit; /* FIX: double indirection */ *matches = dbiFreeIndexSet(*matches); @@ -1415,11 +1418,17 @@ static rpmRC dbiFindByLabel(dbiIndex dbi, DBC * dbcursor, DBT * key, DBT * data, break; } - if (s == localarg) return RPMRC_NOTFOUND; + if (s == localarg) { + rc = RPMRC_NOTFOUND; + goto exit; + } *s = '\0'; /* FIX: *matches may be NULL. */ - return dbiFindMatches(dbi, dbcursor, key, data, localarg, s + 1, release, matches); + rc = dbiFindMatches(dbi, dbcursor, key, data, localarg, s + 1, release, matches); +exit: + free(localarg); + return rc; } /** |