diff options
author | Michael Adam <obnox@samba.org> | 2015-11-19 00:34:54 +0100 |
---|---|---|
committer | Michael Adam <obnox@samba.org> | 2016-01-11 12:25:32 +0100 |
commit | bf496153bc280ed58ee25de599b08446bebf738e (patch) | |
tree | d1e7240e936cd49f49bf80f79110eeb4a3928d3c | |
parent | 736fa61a9546c48d03cbd75897f7e6956ed48c0e (diff) | |
download | samba-bf496153bc280ed58ee25de599b08446bebf738e.tar.gz |
nwrap: catch error to add item to vector in nwrap_he_parse_line()
Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
-rw-r--r-- | lib/nss_wrapper/nss_wrapper.c | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/lib/nss_wrapper/nss_wrapper.c b/lib/nss_wrapper/nss_wrapper.c index 4bde91ca3ac..f7979decfae 100644 --- a/lib/nss_wrapper/nss_wrapper.c +++ b/lib/nss_wrapper/nss_wrapper.c @@ -2757,8 +2757,13 @@ static bool nwrap_he_parse_line(struct nwrap_cache *nwrap, char *line) } ip = i; - nwrap_vector_add_item(&(ed->nwrap_addrdata), - (void *const)ed->addr.host_addr); + ok = nwrap_vector_add_item(&(ed->nwrap_addrdata), + (void *const)ed->addr.host_addr); + if (!ok) { + NWRAP_LOG(NWRAP_LOG_ERROR, "Unable to add addrdata to vector"); + free(ed); + return false; + } ed->ht.h_addr_list = nwrap_vector_head(&ed->nwrap_addrdata); p++; @@ -2844,7 +2849,12 @@ static bool nwrap_he_parse_line(struct nwrap_cache *nwrap, char *line) aliases_count += 1; } - nwrap_vector_add_item(&(nwrap_he->entries), (void *const)ed); + ok = nwrap_vector_add_item(&(nwrap_he->entries), (void *const)ed); + if (!ok) { + NWRAP_LOG(NWRAP_LOG_ERROR, "Unable to add entry to vector"); + free(ed); + return false; + } ed->aliases_count = aliases_count; /* Inventarize item */ |