diff --git a/main/acl.c b/main/acl.c
index 236d8b6c470f826419f0723328ae1df413699480..148cb0825c149078009e305ab1eeb56bc4003e44 100644
--- a/main/acl.c
+++ b/main/acl.c
@@ -131,9 +131,9 @@ static int get_local_address(struct ast_sockaddr *ourip)
 	struct ifaddrs *ifap, *ifaphead;
 	int rtnerr;
 	const struct sockaddr_in *sin;
-	int best_score = -100;
 #endif /* BSD_OR_LINUX */
 	struct in_addr best_addr;
+	int best_score = -100;
 	memset(&best_addr, 0, sizeof(best_addr));
 
 #if defined(__OpenBSD__) || defined(__NetBSD__) || defined(__FreeBSD__) || defined(__linux__) || defined(__Darwin__) || defined(__GLIBC__)