]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Use coccinelle to cleanup the failure handling blocks from isc_mem_allocate
authorOndřej Surý <ondrej@sury.org>
Tue, 23 Jul 2019 14:56:26 +0000 (10:56 -0400)
committerOndřej Surý <ondrej@sury.org>
Tue, 23 Jul 2019 19:32:35 +0000 (15:32 -0400)
23 files changed:
bin/dig/dighost.c
bin/dig/nslookup.c
bin/dnssec/dnssec-keyfromlabel.c
bin/dnssec/dnssec-signzone.c
bin/named/zoneconf.c
bin/nsupdate/nsupdate.c
bin/tools/mdig.c
contrib/dlz/drivers/dlz_filesystem_driver.c
contrib/dlz/drivers/dlz_ldap_driver.c
contrib/dlz/drivers/dlz_mysql_driver.c
contrib/dlz/drivers/dlz_odbc_driver.c
contrib/dlz/drivers/dlz_postgres_driver.c
contrib/dlz/drivers/sdlz_helper.c
lib/dns/diff.c
lib/dns/keydata.c
lib/dns/masterdump.c
lib/dns/name.c
lib/dns/openssl_link.c
lib/dns/rdata.c
lib/dns/ssu_external.c
lib/dns/zone.c
lib/isc/unix/file.c
lib/isc/win32/file.c

index c3e553b7abc2f1432349e53053227a5a8ab4f663..b20cb05c9c61bef7acde1dad1999ef2ec599bda4 100644 (file)
@@ -446,9 +446,6 @@ make_server(const char *servname, const char *userarg) {
 
        debug("make_server(%s)", servname);
        srv = isc_mem_allocate(mctx, sizeof(struct dig_server));
-       if (srv == NULL)
-               fatal("memory allocation failure in %s:%d",
-                     __FILE__, __LINE__);
        strlcpy(srv->servername, servname, MXNAME);
        strlcpy(srv->userarg, userarg, MXNAME);
        ISC_LINK_INIT(srv, link);
@@ -576,9 +573,6 @@ make_empty_lookup(void) {
        INSIST(!free_now);
 
        looknew = isc_mem_allocate(mctx, sizeof(struct dig_lookup));
-       if (looknew == NULL)
-               fatal("memory allocation failure in %s:%d",
-                      __FILE__, __LINE__);
        looknew->pending = true;
        looknew->textname[0] = 0;
        looknew->cmdline[0] = 0;
@@ -681,8 +675,6 @@ cloneopts(dig_lookup_t *looknew, dig_lookup_t *lookold) {
        size_t len = sizeof(looknew->ednsopts[0]) * EDNSOPT_OPTIONS;
        size_t i;
        looknew->ednsopts = isc_mem_allocate(mctx, len);
-       if (looknew->ednsopts == NULL)
-               fatal("out of memory");
        for (i = 0; i < EDNSOPT_OPTIONS; i++) {
                looknew->ednsopts[i].code = 0;
                looknew->ednsopts[i].length = 0;
@@ -696,10 +688,8 @@ cloneopts(dig_lookup_t *looknew, dig_lookup_t *lookold) {
                len = lookold->ednsopts[i].length;
                if (len != 0) {
                        INSIST(lookold->ednsopts[i].value != NULL);
-                       looknew->ednsopts[i].value =
-                                isc_mem_allocate(mctx, len);
-                       if (looknew->ednsopts[i].value == NULL)
-                               fatal("out of memory");
+                       looknew->ednsopts[i].value = isc_mem_allocate(mctx,
+                                                                     len);
                        memmove(looknew->ednsopts[i].value,
                                lookold->ednsopts[i].value, len);
                }
@@ -805,8 +795,6 @@ clone_lookup(dig_lookup_t *lookold, bool servers) {
        if (lookold->ecs_addr != NULL) {
                size_t len = sizeof(isc_sockaddr_t);
                looknew->ecs_addr = isc_mem_allocate(mctx, len);
-               if (looknew->ecs_addr == NULL)
-                       fatal("out of memory");
                memmove(looknew->ecs_addr, lookold->ecs_addr, len);
        }
 
@@ -865,9 +853,6 @@ setup_text_key(void) {
        isc_buffer_putstr(namebuf, keynametext);
        secretsize = (unsigned int) strlen(keysecret) * 3 / 4;
        secretstore = isc_mem_allocate(mctx, secretsize);
-       if (secretstore == NULL)
-               fatal("memory allocation failure in %s:%d",
-                     __FILE__, __LINE__);
        isc_buffer_init(&secretbuf, secretstore, secretsize);
        result = isc_base64_decodestring(keysecret, &secretbuf);
        if (result != ISC_R_SUCCESS)
@@ -957,8 +942,6 @@ parse_netprefix(isc_sockaddr_t **sap, const char *value) {
                fatal("invalid prefix '%s'\n", value);
 
        sa = isc_mem_allocate(mctx, sizeof(*sa));
-       if (sa == NULL)
-               fatal("out of memory");
        memset(sa, 0, sizeof(*sa));
 
        if (strcmp(buf, "0") == 0) {
@@ -1190,9 +1173,6 @@ static dig_searchlist_t *
 make_searchlist_entry(char *domain) {
        dig_searchlist_t *search;
        search = isc_mem_allocate(mctx, sizeof(*search));
-       if (search == NULL)
-               fatal("memory allocation failure in %s:%d",
-                     __FILE__, __LINE__);
        strlcpy(search->origin, domain, MXNAME);
        search->origin[MXNAME-1] = 0;
        ISC_LINK_INIT(search, link);
@@ -1456,9 +1436,7 @@ save_opt(dig_lookup_t *lookup, char *code, char *value) {
 
        if (value != NULL) {
                char *buf;
-               buf = isc_mem_allocate(mctx, strlen(value)/2 + 1);
-               if (buf == NULL)
-                       fatal("out of memory");
+               buf = isc_mem_allocate(mctx, strlen(value) / 2 + 1);
                isc_buffer_init(&b, buf, (unsigned int) strlen(value)/2 + 1);
                result = isc_hex_decodestring(value, &b);
                check_result(result, "isc_hex_decodestring");
@@ -2489,10 +2467,6 @@ setup_lookup(dig_lookup_t *lookup) {
             serv = ISC_LIST_NEXT(serv, link))
        {
                query = isc_mem_allocate(mctx, sizeof(dig_query_t));
-               if (query == NULL) {
-                       fatal("memory allocation failure in %s:%d",
-                             __FILE__, __LINE__);
-               }
                debug("create query %p linked to lookup %p", query, lookup);
                query->lookup = lookup;
                query->timer = NULL;
index 486332ebb31c60f9b866218c0a44854980231a11..2363903e9d5b6bc2f78694dc24124fee635ad79c 100644 (file)
@@ -850,8 +850,6 @@ get_next_command(void) {
 
        fflush(stdout);
        buf = isc_mem_allocate(mctx, COMMSIZE);
-       if (buf == NULL)
-               fatal("memory allocation failure");
        isc_app_block();
        if (interactive) {
 #ifdef HAVE_READLINE
index ea156c76774c9cffa57b0bedbcc2b65e61adb3ab..888d34bc09b98b12a48eddccb4f7b9296c6f493b 100644 (file)
@@ -368,8 +368,6 @@ main(int argc, char **argv) {
 
                        len = strlen(label) + 8;
                        l = isc_mem_allocate(mctx, len);
-                       if (l == NULL)
-                               fatal("cannot allocate memory");
                        snprintf(l, len, "pkcs11:%s", label);
                        isc_mem_free(mctx, label);
                        label = l;
index cecf7b02be1977ccc4138bfb42776540593c0f2c..c440e8f10c2206f9da98184231e96fa7d38f29a2 100644 (file)
@@ -3577,8 +3577,6 @@ main(int argc, char *argv[]) {
                free_output = true;
                size = strlen(file) + strlen(".signed") + 1;
                output = isc_mem_allocate(mctx, size);
-               if (output == NULL)
-                       fatal("out of memory");
                snprintf(output, size, "%s.signed", file);
        }
 
index 1fbd3003cb86939e3be55d5d8930d1b137ded60e..07dffc77b1b6de2bf7fd773b05cd51a4e6823187 100644 (file)
@@ -963,8 +963,6 @@ named_zone_configure(const cfg_obj_t *config, const cfg_obj_t *vconfig,
 
                len = strlen(dlzname) + 5;
                cpval = isc_mem_allocate(mctx, len);
-               if (cpval == NULL)
-                       return (ISC_R_NOMEMORY);
                snprintf(cpval, len, "dlz %s", dlzname);
        }
 
index 49b79a92900c56e675d441b8822213fdaa1a6803..20f2b24fb3f649d71da16d83c96f088d97993842 100644 (file)
@@ -514,8 +514,6 @@ setup_keystr(void) {
 
        secretlen = strlen(secretstr) * 3 / 4;
        secret = isc_mem_allocate(gmctx, secretlen);
-       if (secret == NULL)
-               fatal("out of memory");
 
        isc_buffer_init(&secretbuf, secret, secretlen);
        result = isc_base64_decodestring(secretstr, &secretbuf);
@@ -584,8 +582,6 @@ read_sessionkey(isc_mem_t *mctx, isc_log_t *lctx) {
 
        len = strlen(algorithm) + strlen(mykeyname) + strlen(secretstr) + 3;
        keystr = isc_mem_allocate(mctx, len);
-       if (keystr == NULL)
-               fatal("out of memory");
        snprintf(keystr, len, "%s:%s:%s", algorithm, mykeyname, secretstr);
        setup_keystr();
 
@@ -1602,8 +1598,6 @@ evaluate_key(char *cmdline) {
        }
        secretlen = strlen(secretstr) * 3 / 4;
        secret = isc_mem_allocate(gmctx, secretlen);
-       if (secret == NULL)
-               fatal("out of memory");
 
        isc_buffer_init(&secretbuf, secret, secretlen);
        result = isc_base64_decodestring(secretstr, &secretbuf);
index c2b19a27aea7b8f0110f6aff8bcbcd7108d7cbe4..3c065af7b81456fa4239ab3d74fdf32b609bd479 100644 (file)
@@ -845,8 +845,6 @@ newopts(struct query *query) {
        size_t i;
 
        query->ednsopts = isc_mem_allocate(mctx, len);
-       if (query->ednsopts == NULL)
-               fatal("out of memory");
 
        for (i = 0; i < EDNSOPTS; i++) {
                query->ednsopts[i].code = 0;
@@ -880,10 +878,7 @@ save_opt(struct query *query, char *code, char *value) {
 
        if (value != NULL) {
                char *buf;
-               buf = isc_mem_allocate(mctx, strlen(value)/2 + 1);
-               if (buf == NULL) {
-                       fatal("out of memory");
-               }
+               buf = isc_mem_allocate(mctx, strlen(value) / 2 + 1);
                isc_buffer_init(&b, buf, strlen(value)/2 + 1);
                result = isc_hex_decodestring(value, &b);
                CHECK("isc_hex_decodestring", result);
@@ -923,8 +918,6 @@ parse_netprefix(isc_sockaddr_t **sap, const char *value) {
        }
 
        sa = isc_mem_allocate(mctx, sizeof(*sa));
-       if (sa == NULL)
-               fatal("out of memory");
        if (inet_pton(AF_INET6, buf, &in6) == 1) {
                parsed = true;
                isc_sockaddr_fromin6(sa, &in6, 0);
@@ -1690,17 +1683,11 @@ clone_default_query() {
        struct query *query;
 
        query = isc_mem_allocate(mctx, sizeof(struct query));
-       if (query == NULL)
-               fatal("memory allocation failure in %s:%d",
-                     __FILE__, __LINE__);
        memmove(query, &default_query, sizeof(struct query));
        if (default_query.ecs_addr != NULL) {
                size_t len = sizeof(isc_sockaddr_t);
 
                query->ecs_addr = isc_mem_allocate(mctx, len);
-               if (query->ecs_addr == NULL)
-                       fatal("memory allocation failure in %s:%d",
-                             __FILE__, __LINE__);
                memmove(query->ecs_addr, default_query.ecs_addr, len);
        }
 
index cec74d73dfb552e535f773313a8c12f30b8c03b9..f21670cd3fc31bbf6e6f9003ee6ec50f72972a2a 100644 (file)
@@ -277,16 +277,7 @@ create_path(const char *zone, const char *host, const char *client,
        if (cd->splitcnt > 0)
                pathsize += len/cd->splitcnt;
 
-       tmpPath = isc_mem_allocate(named_g_mctx , pathsize * sizeof(char));
-       if (tmpPath == NULL) {
-               /* write error message */
-               isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
-                             DNS_LOGMODULE_DLZ, ISC_LOG_ERROR,
-                             "Filesystem driver unable to "
-                             "allocate memory in create_path().");
-               result = ISC_R_NOMEMORY;
-               goto cleanup_mem;
-       }
+       tmpPath = isc_mem_allocate(named_g_mctx, pathsize * sizeof(char));
 
        /*
         * build path string.
index e8e5566f2a0a954158de96f7f371c4cb6bc76e97..7b9b676df843819c6328bb4375042c1b9bd04759 100644 (file)
@@ -363,14 +363,6 @@ ldap_process_results(LDAP *dbc, LDAPMessage *msg, char ** attrs,
 
                /* allocate memory for data string */
                data = isc_mem_allocate(named_g_mctx, len + 1);
-               if (data == NULL) {
-                       isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
-                                     DNS_LOGMODULE_DLZ, ISC_LOG_ERROR,
-                                     "LDAP driver unable to allocate memory "
-                                     "while processing results");
-                       result = ISC_R_FAILURE;
-                       goto cleanup;
-               }
 
                /*
                 * Make sure data is null termed at the beginning so
index d108773b206c2ce942ab90dcc99580e2f3cfe541..da1c9393c015d88e2de9a66cb2b47e5456b803e7 100644 (file)
@@ -99,9 +99,7 @@ mysqldrv_escape_string(MYSQL *mysql, const char *instr) {
 
        len = strlen(instr);
 
-       outstr = isc_mem_allocate(named_g_mctx ,(2 * len * sizeof(char)) + 1);
-       if (outstr == NULL)
-               return NULL;
+       outstr = isc_mem_allocate(named_g_mctx, (2 * len * sizeof(char)) + 1);
 
        mysql_real_escape_string(mysql, outstr, instr, len);
 
@@ -426,17 +424,6 @@ mysql_process_rs(dns_sdlzlookup_t *lookup, MYSQL_RES *rs)
                         * term string
                         */
                        tmpString = isc_mem_allocate(named_g_mctx, len + 1);
-                       if (tmpString == NULL) {
-                               /* major bummer, need more ram */
-                               isc_log_write(dns_lctx,
-                                             DNS_LOGCATEGORY_DATABASE,
-                                             DNS_LOGMODULE_DLZ, ISC_LOG_ERROR,
-                                             "mysql driver unable "
-                                             "to allocate memory for "
-                                             "temporary string");
-                               mysql_free_result(rs);
-                               return (ISC_R_FAILURE); /* Yeah, I'd say! */
-                       }
                        /* copy field to tmpString */
                        strcpy(tmpString, safeGet(row[2]));
 
@@ -654,16 +641,6 @@ mysql_allnodes(const char *zone, void *driverarg, void *dbdata,
                        }
                        /* allocate memory, allow for NULL to term string */
                        tmpString = isc_mem_allocate(named_g_mctx, len + 1);
-                       if (tmpString == NULL) {        /* we need more ram. */
-                               isc_log_write(dns_lctx,
-                                             DNS_LOGCATEGORY_DATABASE,
-                                             DNS_LOGMODULE_DLZ, ISC_LOG_ERROR,
-                                             "mysql driver unable "
-                                             "to allocate memory for "
-                                             "temporary string");
-                               mysql_free_result(rs);
-                               return (ISC_R_FAILURE);
-                       }
                        /* copy this field to tmpString */
                        strcpy(tmpString, safeGet(row[3]));
                        /* concatonate the rest, with spaces between */
index 59468054253eca54ec5c239aad2bb431878113dd..c5a1a156f3fffbbab78a379a0ac721e9f61e551b 100644 (file)
@@ -209,12 +209,6 @@ odbc_connect(odbc_instance_t *dbi, odbc_db_t **dbc) {
                }
        } else {
                ndb = isc_mem_allocate(named_g_mctx, sizeof(odbc_db_t));
-               if (ndb == NULL) {
-                       isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
-                                     DNS_LOGMODULE_DLZ, ISC_LOG_ERROR,
-                                     "Odbc driver unable to allocate memory");
-                       return ISC_R_NOMEMORY;
-               }
                memset(ndb, 0, sizeof(odbc_db_t));
        }
 
@@ -335,9 +329,7 @@ odbc_escape_string(const char *instr) {
 
        len = strlen(instr);
 
-       outstr = isc_mem_allocate(named_g_mctx ,(2 * len * sizeof(char)) + 1);
-       if (outstr == NULL)
-               return NULL;
+       outstr = isc_mem_allocate(named_g_mctx, (2 * len * sizeof(char)) + 1);
 
        odbc_makesafe(outstr, instr, len);
 
@@ -715,8 +707,6 @@ odbc_getManyFields(SQLHSTMT *stmnt, SQLSMALLINT startField,
 
        /* allow for a "\n" at the end of the string/ */
        data = isc_mem_allocate(named_g_mctx, ++totSize);
-       if (data == NULL)
-               return ISC_R_NOMEMORY;
 
        result = ISC_R_FAILURE;
 
index 734a53c79ccfbe1a5e72f7a0782a52f73e78c642..3bd72b59eec6271983b9e7161bb5cd47f8586aec 100644 (file)
@@ -240,9 +240,7 @@ postgres_escape_string(const char *instr) {
 
        len = strlen(instr);
 
-       outstr = isc_mem_allocate(named_g_mctx ,(2 * len * sizeof(char)) + 1);
-       if (outstr == NULL)
-               return NULL;
+       outstr = isc_mem_allocate(named_g_mctx, (2 * len * sizeof(char)) + 1);
 
        postgres_makesafe(outstr, instr, len);
        /* PQescapeString(outstr, instr, len); */
@@ -676,17 +674,6 @@ postgres_process_rs(dns_sdlzlookup_t *lookup, PGresult *rs)
                         * term string
                         */
                        tmpString = isc_mem_allocate(named_g_mctx, len + 1);
-                       if (tmpString == NULL) {
-                               /* major bummer, need more ram */
-                               isc_log_write(dns_lctx,
-                                             DNS_LOGCATEGORY_DATABASE,
-                                             DNS_LOGMODULE_DLZ, ISC_LOG_ERROR,
-                                             "Postgres driver unable to "
-                                             "allocate memory for "
-                                             "temporary string");
-                               PQclear(rs);
-                               return (ISC_R_FAILURE); /* Yeah, I'd say! */
-                       }
                        /* copy field to tmpString */
                        strcpy(tmpString, PQgetvalue(rs, i, 2));
                        /*
@@ -906,16 +893,6 @@ postgres_allnodes(const char *zone, void *driverarg, void *dbdata,
                        }
                        /* allocate memory, allow for NULL to term string */
                        tmpString = isc_mem_allocate(named_g_mctx, len + 1);
-                       if (tmpString == NULL) {        /* we need more ram. */
-                               isc_log_write(dns_lctx,
-                                             DNS_LOGCATEGORY_DATABASE,
-                                             DNS_LOGMODULE_DLZ, ISC_LOG_ERROR,
-                                             "Postgres driver unable to "
-                                             "allocate memory for "
-                                             "temporary string");
-                               PQclear(rs);
-                               return (ISC_R_FAILURE);
-                       }
                        /* copy this field to tmpString */
                        strcpy(tmpString, PQgetvalue(rs, i, 3));
                        /* concatonate the rest, with spaces between */
index 6f17d07540d0fe25975a8794fdc6e9ff62fd0e19..2ca90cc5c6bf33d96502300df1bc96f56bb78dc6 100644 (file)
@@ -296,9 +296,6 @@ sdlzh_build_querystring(isc_mem_t *mctx, query_list_t *querylist)
 
        /* allocate memory for the string */
        qs = isc_mem_allocate(mctx, length + 1);
-       /* couldn't allocate memory,  We need more ram! */
-       if (qs == NULL)
-               return NULL;
 
        *qs = 0;
        /* start at the top of the list again */
index bca15aff89f551e5459f0208c0a21ea74f36c81e..3f5d8d2ef6412f64bde87d8445f959d42b48ac46 100644 (file)
@@ -66,8 +66,6 @@ dns_difftuple_create(isc_mem_t *mctx,
         */
        size = sizeof(*t) + name->length + rdata->length;
        t = isc_mem_allocate(mctx, size);
-       if (t == NULL)
-               return (ISC_R_NOMEMORY);
        t->mctx = NULL;
        isc_mem_attach(mctx, &t->mctx);
        t->op = op;
index bd2c144e4b9b30d84f68ec9403c29631d376476c..8bdd560cadde1a19159850847c4221a70aba62ed 100644 (file)
@@ -42,8 +42,6 @@ dns_keydata_todnskey(dns_rdata_keydata_t *keydata,
                dnskey->data = keydata->data;
        else {
                dnskey->data = isc_mem_allocate(mctx, dnskey->datalen);
-               if (dnskey->data == NULL)
-                       return (ISC_R_NOMEMORY);
                memmove(dnskey->data, keydata->data, dnskey->datalen);
        }
 
@@ -73,8 +71,6 @@ dns_keydata_fromdnskey(dns_rdata_keydata_t *keydata,
                keydata->data = dnskey->data;
        else {
                keydata->data = isc_mem_allocate(mctx, keydata->datalen);
-               if (keydata->data == NULL)
-                       return (ISC_R_NOMEMORY);
                memmove(keydata->data, dnskey->data, keydata->datalen);
        }
 
index 46fcb49f88bd36417e0c7956d1f292048c06fdd8..ff781791dcbe6eb483ab776f2678e05e35e6e162 100644 (file)
@@ -1804,8 +1804,6 @@ opentmp(isc_mem_t *mctx, dns_masterformat_t format, const char *file,
 
        tempnamelen = strlen(file) + 20;
        tempname = isc_mem_allocate(mctx, tempnamelen);
-       if (tempname == NULL)
-               return (ISC_R_NOMEMORY);
 
        result = isc_file_mktemplate(file, tempname, tempnamelen);
        if (result != ISC_R_SUCCESS)
index bd463d7afc41b44e15e9afa3f08e918efbe08195..03ec8f32c0ab5255dae2771585efa75f7257b5a6 100644 (file)
@@ -2402,8 +2402,6 @@ dns_name_tostring(const dns_name_t *name, char **target, isc_mem_t *mctx) {
 
        isc_buffer_usedregion(&buf, &reg);
        p = isc_mem_allocate(mctx, reg.length + 1);
-       if (p == NULL)
-               return (ISC_R_NOMEMORY);
        memmove(p, (char *) reg.base, (int) reg.length);
        p[reg.length] = '\0';
 
index eace2c701d50380d61faac885d32376f32d8cc1e..364168f328f2935b70d5252317eb39fdfc176644 100644 (file)
@@ -113,8 +113,6 @@ dst__openssl_init(isc_mem_t *mctx, const char *engine) {
 #if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
        nlocks = CRYPTO_num_locks();
        locks = isc_mem_allocate(dst__mctx, sizeof(isc_mutex_t) * nlocks);
-       if (locks == NULL)
-               return (ISC_R_NOMEMORY);
        isc_mutexblock_init(locks, nlocks);
        CRYPTO_set_locking_callback(lock_callback);
 # if defined(LIBRESSL_VERSION_NUMBER)
index b88df968e19aab8bbbf08399e7eb46f21adc7fe8..bbbc33e8a99a571121e448cdc23c1177d0b7412b 100644 (file)
@@ -387,8 +387,7 @@ mem_maybedup(isc_mem_t *mctx, void *source, size_t length) {
        if (mctx == NULL)
                return (source);
        copy = isc_mem_allocate(mctx, length);
-       if (copy != NULL)
-               memmove(copy, source, length);
+       memmove(copy, source, length);
 
        return (copy);
 }
index 95f2c2ca5c90203c885b9a5c9a94bf167a04f5c9..6e49aabd142bf8e1da5a6f272fa59ca752a6207e 100644 (file)
@@ -190,10 +190,6 @@ dns_ssu_external_match(const dns_name_t *identity,
 
        /* format the buffer */
        data = isc_mem_allocate(mctx, req_len);
-       if (data == NULL) {
-               close(fd);
-               return (false);
-       }
 
        isc_buffer_init(&buf, data, req_len);
        isc_buffer_putuint32(&buf, SSU_EXTERNAL_VERSION);
index 85ff3afbbd7cf8b2e39036731c9bba67216c1123..ed99c4928b2ca64c90e060dcf33fb9e2f5954f65 100644 (file)
@@ -1421,7 +1421,7 @@ dns_zone_getdbtype(dns_zone_t *zone, char ***argv, isc_mem_t *mctx) {
        for (i = 0; i < zone->db_argc; i++)
                size += strlen(zone->db_argv[i]) + 1;
        mem = isc_mem_allocate(mctx, size);
-       if (mem != NULL) {
+       {
                tmp = mem;
                tmp2 = mem;
                base = mem;
@@ -1432,8 +1432,7 @@ dns_zone_getdbtype(dns_zone_t *zone, char ***argv, isc_mem_t *mctx) {
                        tmp2 += strlen(tmp2) + 1;
                }
                *tmp = NULL;
-       } else
-               result = ISC_R_NOMEMORY;
+       }
        UNLOCK_ZONE(zone);
        *argv = mem;
        return (result);
@@ -1671,8 +1670,6 @@ default_journal(dns_zone_t *zone) {
                /* Calculate string length including '\0'. */
                int len = strlen(zone->masterfile) + sizeof(".jnl");
                journal = isc_mem_allocate(zone->mctx, len);
-               if (journal == NULL)
-                       return (ISC_R_NOMEMORY);
                strlcpy(journal, zone->masterfile, len);
                strlcat(journal, ".jnl", len);
        } else {
@@ -19701,8 +19698,6 @@ dns_zone_getincludes(dns_zone_t *zone, char ***includesp) {
                goto done;
 
        array = isc_mem_allocate(zone->mctx, sizeof(char *) * zone->nincludes);
-       if (array == NULL)
-               goto done;
        for (include = ISC_LIST_HEAD(zone->includes);
             include != NULL;
             include = ISC_LIST_NEXT(include, link)) {
index 4c85dffd98b7b0551af08c86657e4c2465cc301e..65aebdf24fe79de0db921d584c7ab77039a09d2a 100644 (file)
@@ -629,8 +629,7 @@ isc_file_splitpath(isc_mem_t *mctx, const char *path, char **dirname,
        } else if (slash != NULL) {
                file = ++slash;
                dir = isc_mem_allocate(mctx, slash - path);
-               if (dir != NULL)
-                       strlcpy(dir, path, slash - path);
+               strlcpy(dir, path, slash - path);
        } else {
                file = path;
                dir = isc_mem_strdup(mctx, ".");
index 20927c622cc95224b5bbfade5307c0cc7a293e90..ad5ba506913071bb7a63ceaae1ae836b78a9afed 100644 (file)
@@ -714,8 +714,7 @@ isc_file_splitpath(isc_mem_t *mctx, const char *path, char **dirname,
        } else if (slash != NULL) {
                file = ++slash;
                dir = isc_mem_allocate(mctx, slash - path);
-               if (dir != NULL)
-                       strlcpy(dir, path, slash - path);
+               strlcpy(dir, path, slash - path);
        } else {
                file = path;
                dir = isc_mem_strdup(mctx, ".");