summaryrefslogtreecommitdiff
path: root/rpmdb
diff options
context:
space:
mode:
authorPanu Matilainen <pmatilai@redhat.com>2008-04-09 13:48:00 +0300
committerPanu Matilainen <pmatilai@redhat.com>2008-04-09 13:48:00 +0300
commit71018d6d2d67b0e17c737e7a90cc6bb704e224ba (patch)
tree3fe7c93652b4361993ac571df3f1df1815a0e5e5 /rpmdb
parentf6134083c29c6cbb3be255fadae47a03d35b09f1 (diff)
downloadlibrpm-tizen-71018d6d2d67b0e17c737e7a90cc6bb704e224ba.tar.gz
librpm-tizen-71018d6d2d67b0e17c737e7a90cc6bb704e224ba.tar.bz2
librpm-tizen-71018d6d2d67b0e17c737e7a90cc6bb704e224ba.zip
Replace alloca+memset with xcalloc() in rpmdbAdd()
Diffstat (limited to 'rpmdb')
-rw-r--r--rpmdb/rpmdb.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/rpmdb/rpmdb.c b/rpmdb/rpmdb.c
index f8798f16e..8aafa1330 100644
--- a/rpmdb/rpmdb.c
+++ b/rpmdb/rpmdb.c
@@ -2669,8 +2669,8 @@ int rpmdbAdd(rpmdb db, int iid, Header h,
rpmRC (*hdrchk) (rpmts ts, const void *uh, size_t uc, char ** msg))
{
DBC * dbcursor = NULL;
- DBT * key = alloca(sizeof(*key));
- DBT * data = alloca(sizeof(*data));
+ DBT * key;
+ DBT * data;
HGE_t hge = (HGE_t)headerGetEntryMinMemory;
HFD_t hfd = headerFreeData;
sigset_t signalMask;
@@ -2688,8 +2688,8 @@ int rpmdbAdd(rpmdb db, int iid, Header h,
if (db == NULL)
return 0;
- memset(key, 0, sizeof(*key));
- memset(data, 0, sizeof(*data));
+ key = xcalloc(1, sizeof(*key));
+ data = xcalloc(1, sizeof(*data));
#ifdef NOTYET /* XXX headerRemoveEntry() broken on dribbles. */
xx = headerRemoveEntry(h, RPMTAG_REMOVETID);
@@ -3046,6 +3046,8 @@ int rpmdbAdd(rpmdb db, int iid, Header h,
exit:
(void) unblockSignals(db, &signalMask);
+ free(key);
+ free(data);
return ret;
}