nwrap: better error propagation in nwrap_he_parse_line()
authorMichael Adam <obnox@samba.org>
Wed, 11 Nov 2015 11:30:36 +0000 (12:30 +0100)
committerMichael Adam <obnox@samba.org>
Mon, 11 Jan 2016 11:25:30 +0000 (12:25 +0100)
Use the return codes of nwrap_add_hname() and nwrap_add_ai().

Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
lib/nss_wrapper/nss_wrapper.c

index 71f5980dcf14df4c20e5898da9f40554f4ea3be6..fd2a9678ea63d4fc84ce0af3e5c988e88b6d50bd 100644 (file)
@@ -2738,6 +2738,7 @@ static bool nwrap_he_parse_line(struct nwrap_cache *nwrap, char *line)
        char *n;
 
        char *ip;
+       bool ok;
 
        struct nwrap_entdata *ed = (struct nwrap_entdata *)
                                   malloc(sizeof(struct nwrap_entdata));
@@ -2886,8 +2887,15 @@ static bool nwrap_he_parse_line(struct nwrap_cache *nwrap, char *line)
 
        ed->aliases_count = aliases_count;
        /* Inventarize item */
-       nwrap_add_hname(ed);
-       nwrap_add_ai(ip, ed);
+       ok = nwrap_add_hname(ed);
+       if (!ok) {
+               return false;
+       }
+
+       ok = nwrap_add_ai(ip, ed);
+       if (!ok) {
+               return false;
+       }
 
        nwrap_he->num++;
        return true;