summaryrefslogtreecommitdiff
path: root/rpmdb/header.c
diff options
context:
space:
mode:
authorPanu Matilainen <pmatilai@redhat.com>2008-04-29 12:45:51 +0300
committerPanu Matilainen <pmatilai@redhat.com>2008-04-29 12:45:51 +0300
commit226c4d16279702593ff814b1573e79e33e17fd72 (patch)
treef6c0de65cb323e6600a84e9ffb9c66d85d96b3cb /rpmdb/header.c
parentcde5bfe5180906783ca26257e05349d82f8d9272 (diff)
downloadlibrpm-tizen-226c4d16279702593ff814b1573e79e33e17fd72.tar.gz
librpm-tizen-226c4d16279702593ff814b1573e79e33e17fd72.tar.bz2
librpm-tizen-226c4d16279702593ff814b1573e79e33e17fd72.zip
Avoid alloca() in headerAddI18NString()
Diffstat (limited to 'rpmdb/header.c')
-rw-r--r--rpmdb/header.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/rpmdb/header.c b/rpmdb/header.c
index 702bed611..53f2b362a 100644
--- a/rpmdb/header.c
+++ b/rpmdb/header.c
@@ -1589,12 +1589,14 @@ int headerAddI18NString(Header h, rpmTag tag, const char * string,
}
if (!entry) {
- strArray = alloca(sizeof(*strArray) * (langNum + 1));
+ int rc;
+ strArray = xmalloc(sizeof(*strArray) * (langNum + 1));
for (i = 0; i < langNum; i++)
strArray[i] = "";
strArray[langNum] = string;
- return headerAddEntry(h, tag, RPM_I18NSTRING_TYPE, strArray,
- langNum + 1);
+ rc = headerAddEntry(h, tag, RPM_I18NSTRING_TYPE, strArray, langNum + 1);
+ free(strArray);
+ return rc;
} else if (langNum >= entry->info.count) {
ghosts = langNum - entry->info.count;