]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
cleanup error handling.
authorMark Andrews <marka@isc.org>
Wed, 5 Feb 2020 05:35:15 +0000 (16:35 +1100)
committerMark Andrews <marka@isc.org>
Wed, 5 Feb 2020 07:37:17 +0000 (18:37 +1100)
336 cleanup_mem:
337        /* cleanup memory */
338
339        /* free tmpPath memory */

CID 1452701 (#1 of 1): Dereference before null check (REVERSE_INULL)
check_after_deref: Null-checking tmpPath suggests that it
may be null, but it has already been dereferenced on all
paths leading to the check.

340        if (tmpPath != NULL && result != ISC_R_SUCCESS)
341                isc_mem_free(named_g_mctx, tmpPath);
342
343        /* free tmpPath memory */
344        return (result);

contrib/dlz/drivers/dlz_filesystem_driver.c

index dbe15291d532555dd740d5475063cb142ddad7c5..05ce2ef8c45416f8e468226379127b6ede745707 100644 (file)
@@ -157,7 +157,7 @@ is_safe(const char *input) {
        return (true);
 }
 
-static isc_result_t
+static void
 create_path_helper(char *out, const char *in, config_data_t *cd) {
        char *tmpString;
        char *tmpPtr;
@@ -206,7 +206,6 @@ create_path_helper(char *out, const char *in, config_data_t *cd) {
        }
 
        isc_mem_free(named_g_mctx, tmpString);
-       return (ISC_R_SUCCESS);
 }
 
 /*%
@@ -223,7 +222,6 @@ create_path(const char *zone, const char *host, const char *client,
        char *tmpPath;
        int pathsize;
        int len;
-       isc_result_t result;
        bool isroot = false;
 
        /* we require a zone & cd parameter */
@@ -285,9 +283,7 @@ create_path(const char *zone, const char *host, const char *client,
 
        /* add zone name - parsed properly */
        if (!isroot) {
-               result = create_path_helper(tmpPath, zone, cd);
-               if (result != ISC_R_SUCCESS)
-                       goto cleanup_mem;
+               create_path_helper(tmpPath, zone, cd);
        }
 
        /*
@@ -322,26 +318,13 @@ create_path(const char *zone, const char *host, const char *client,
        /* if host not null, add it. */
        if (host != NULL) {
                strncat(tmpPath, (char *) &cd->pathsep, 1);
-               if ((result = create_path_helper(tmpPath, host,
-                                                cd)) != ISC_R_SUCCESS)
-                       goto cleanup_mem;
+               create_path_helper(tmpPath, host, cd);
        }
 
        /* return the path we built. */
        *path = tmpPath;
 
-       /* return success */
-       result = ISC_R_SUCCESS;
-
- cleanup_mem:
-       /* cleanup memory */
-
-       /* free tmpPath memory */
-       if (tmpPath != NULL && result != ISC_R_SUCCESS)
-               isc_mem_free(named_g_mctx, tmpPath);
-
-       /* free tmpPath memory */
-       return (result);
+       return (ISC_R_SUCCESS);
 }
 
 static isc_result_t