diff options
author | Ulrich Drepper <drepper@redhat.com> | 2006-05-10 02:55:21 +0000 |
---|---|---|
committer | Ulrich Drepper <drepper@redhat.com> | 2006-05-10 02:55:21 +0000 |
commit | 51e5926049360b991d71862e33a97fe1ead4d9a6 (patch) | |
tree | 3089a8fec8cd11641d803075a15c7bdb51f4976b /iconv/iconv_charmap.c | |
parent | e7c8359e431ef305fbc61e4b86af6353b4f39879 (diff) | |
download | glibc-51e5926049360b991d71862e33a97fe1ead4d9a6.tar.gz glibc-51e5926049360b991d71862e33a97fe1ead4d9a6.tar.xz glibc-51e5926049360b991d71862e33a97fe1ead4d9a6.zip |
* nis/nis_defaults.c (searchXYX): New functions. Used by both
searchgroup and searchowner. Significantly simplified. (__nis_default_owner): Remove duplication. Do not locally copy the string before duplicating it. (__nis_default_group): Likewise. * nis/nis_lookup.c (nis_lookup): After calling nis_free_directory, we must clear the variable before calling __nisfind_server. * nis/nis_lookup.c (nis_lookup): Always free memory allocated with nis_getnames. [Coverity CID 223] * locale/programs/locfile.c (locfile_read): Use alloca instead of xmalloc to allocate local repertoire name. [Coverity CID 222] * iconv/iconv_charmap.c (use_to_charmap): No need to dynamically allocate memory for the input to add_bytes. [Coverity CID 221] was allocated here. [Coverity CID 219, 220]
Diffstat (limited to 'iconv/iconv_charmap.c')
-rw-r--r-- | iconv/iconv_charmap.c | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/iconv/iconv_charmap.c b/iconv/iconv_charmap.c index 328121edbe..a54d738120 100644 --- a/iconv/iconv_charmap.c +++ b/iconv/iconv_charmap.c @@ -365,19 +365,27 @@ use_to_charmap (const char *from_code, struct charmap_t *to_charmap) if (outptr != (char *) outbuf) { /* We got some output. Good, use it. */ - struct charseq *newp; + union + { + struct charseq seq; + struct + { + const char *name; + uint32_t ucs4; + int nbytes; + unsigned char bytes[outlen]; + } mem; + } new; outlen = sizeof (outbuf) - outlen; assert ((char *) outbuf + outlen == outptr); - newp = (struct charseq *) xmalloc (sizeof (struct charseq) - + outlen); - newp->name = out->name; - newp->ucs4 = out->ucs4; - newp->nbytes = outlen; - memcpy (newp->bytes, outbuf, outlen); + new.mem.name = out->name; + new.mem.ucs4 = out->ucs4; + new.mem.nbytes = outlen; + memcpy (new.mem.bytes, outbuf, outlen); - add_bytes (rettbl, newp, out); + add_bytes (rettbl, &new.seq, out); } /* Clear any possible state left behind. */ |