diff --git a/src/sacctmgr/file_functions.c b/src/sacctmgr/file_functions.c
index 249e89c92e9f610a3ad45873c541d0c865fb7161..b4ef54b39523f1962a497a2247011921acc138b4 100644
--- a/src/sacctmgr/file_functions.c
+++ b/src/sacctmgr/file_functions.c
@@ -525,9 +525,9 @@ static sacctmgr_file_opts_t *_parse_options(char *options)
 	if (!file_opts->name) {
 		exit_code=1;
 		fprintf(stderr, " No name given\n");
-		_destroy_sacctmgr_file_opts(file_opts);
-		file_opts = NULL;
-	} else if (exit_code) {
+	}
+
+	if (exit_code) {
 		_destroy_sacctmgr_file_opts(file_opts);
 		file_opts = NULL;
 	}