11dd666
diff --git a/libattr/attr_copy_action.c b/libattr/attr_copy_action.c
11dd666
index 0d7aca5..dc94224 100644
11dd666
--- a/libattr/attr_copy_action.c
11dd666
+++ b/libattr/attr_copy_action.c
11dd666
@@ -53,7 +53,7 @@ free_attr_actions(void)
11dd666
 static int
11dd666
 attr_parse_attr_conf(struct error_context *ctx)
11dd666
 {
11dd666
-	char *text, *t;
11dd666
+	char *text = NULL, *t;
11dd666
 	size_t size_guess = 4096, len;
11dd666
 	FILE *file;
11dd666
 	char *pattern = NULL;
11dd666
@@ -64,15 +64,16 @@ attr_parse_attr_conf(struct error_context *ctx)
11dd666
 		return 0;
11dd666
 
11dd666
 repeat:
11dd666
-	text = malloc(size_guess + 1);
11dd666
-	if (!text)
11dd666
-		goto fail;
11dd666
-
11dd666
 	if ((file = fopen(ATTR_CONF, "r")) == NULL) {
11dd666
 		if (errno == ENOENT)
11dd666
 			return 0;
11dd666
 		goto fail;
11dd666
 	}
11dd666
+
11dd666
+	text = malloc(size_guess + 1);
11dd666
+	if (!text)
11dd666
+		goto fail;
11dd666
+
11dd666
 	len = fread(text, 1, size_guess, file);
11dd666
 	if (ferror(file))
11dd666
 		goto fail;