diff options
author | Panu Matilainen <pmatilai@redhat.com> | 2007-12-15 15:59:07 +0200 |
---|---|---|
committer | Panu Matilainen <pmatilai@redhat.com> | 2007-12-15 15:59:07 +0200 |
commit | bc93e6bc874a8a07e33f7e77a8f09bde5588eeaf (patch) | |
tree | 5bc94af738be822b68dfda577e8cd37be86a2de6 /lib/formats.c | |
parent | 23777730c25e440a20b6a7b0ad7d3e348992e976 (diff) | |
download | rpm-bc93e6bc874a8a07e33f7e77a8f09bde5588eeaf.tar.gz rpm-bc93e6bc874a8a07e33f7e77a8f09bde5588eeaf.tar.bz2 rpm-bc93e6bc874a8a07e33f7e77a8f09bde5588eeaf.zip |
Avoid mixing local malloc with const parameter pointer
Diffstat (limited to 'lib/formats.c')
-rw-r--r-- | lib/formats.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/lib/formats.c b/lib/formats.c index 204293eec..fd6d3a5fb 100644 --- a/lib/formats.c +++ b/lib/formats.c @@ -259,8 +259,8 @@ static char * xmlFormat(rpm_tagtype_t type, const void * data, { const char * xtag = NULL; size_t nb; - char * val; - char * s = NULL; + char * val, * bs = NULL; + const char * s = NULL; char * t, * te; unsigned long anint = 0; int xx; @@ -275,10 +275,11 @@ static char * xmlFormat(rpm_tagtype_t type, const void * data, { /* XXX HACK ALERT: element field abused as no. bytes of binary data. */ size_t ns = element; - if ((s = b64encode(data, ns, 0)) == NULL) { + if ((bs = b64encode(data, ns, 0)) == NULL) { /* XXX proper error handling would be better. */ - s = xcalloc(1, padding + (ns / 3) * 4 + 1); + bs = xcalloc(1, padding + (ns / 3) * 4 + 1); } + s = bs; xtag = "base64"; } break; case RPM_CHAR_TYPE: @@ -323,7 +324,7 @@ static char * xmlFormat(rpm_tagtype_t type, const void * data, /* XXX s was malloc'd */ if (!strcmp(xtag, "base64")) - s = _free(s); + free(bs); nb += padding; val = xmalloc(nb+1); |