]> git.ipfire.org Git - thirdparty/knot-resolver.git/commitdiff
zimport: fix error reporting
authorPetr Špaček <petr.spacek@nic.cz>
Mon, 16 Apr 2018 11:59:04 +0000 (13:59 +0200)
committerPetr Špaček <petr.spacek@nic.cz>
Wed, 18 Apr 2018 15:08:28 +0000 (17:08 +0200)
daemon/zimport.c

index 45de989acdfae490ae2793a62790674ca0f32db0..24f3f3971b7d582fd6e38691dcb9b8230e333e21 100644 (file)
@@ -726,18 +726,18 @@ int zi_zone_import(struct zone_import_ctx *z_import,
         * so don't print error code as it meaningless. */
        int res = zs_init(s, origin, rclass, ttl);
        if (res != 0) {
-               free(s);
                kr_log_error("[zscanner] error initializing zone scanner instance, error: %i (%s)\n",
                             s->error.code, zs_strerror(s->error.code));
+               free(s);
                return -1;
        }
 
        res = zs_set_input_file(s, zone_file);
        if (res != 0) {
-               zs_deinit(s);
-               free(s);
                kr_log_error("[zscanner] error opening zone file `%s`, error: %i (%s)\n",
                             zone_file, s->error.code, zs_strerror(s->error.code));
+               zs_deinit(s);
+               free(s);
                return -1;
        }
 
@@ -745,9 +745,11 @@ int zi_zone_import(struct zone_import_ctx *z_import,
         * Parsing as well error processing will be performed in zi_state_parsing().
         * Store pointer to zone import context for further use. */
        if (zs_set_processing(s, NULL, NULL, (void *)z_import) != 0) {
+               kr_log_error("[zscanner] zs_set_processing() failed for zone file `%s`, "
+                               "error: %i (%s)\n",
+                               zone_file, s->error.code, zs_strerror(s->error.code));
                zs_deinit(s);
                free(s);
-               kr_log_error("[zscanner] zs_set_input_file() fails\n");
                return -1;
        }