diff options
author | Panu Matilainen <pmatilai@redhat.com> | 2008-04-29 12:45:51 +0300 |
---|---|---|
committer | Panu Matilainen <pmatilai@redhat.com> | 2008-04-29 12:45:51 +0300 |
commit | 226c4d16279702593ff814b1573e79e33e17fd72 (patch) | |
tree | f6c0de65cb323e6600a84e9ffb9c66d85d96b3cb /rpmdb | |
parent | cde5bfe5180906783ca26257e05349d82f8d9272 (diff) | |
download | rpm-226c4d16279702593ff814b1573e79e33e17fd72.tar.gz rpm-226c4d16279702593ff814b1573e79e33e17fd72.tar.bz2 rpm-226c4d16279702593ff814b1573e79e33e17fd72.zip |
Avoid alloca() in headerAddI18NString()
Diffstat (limited to 'rpmdb')
-rw-r--r-- | rpmdb/header.c | 8 |
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; |