diff --git a/logger.c b/logger.c
index a0f5dac1244c45b457ea682eceb2ed27a36422f7..91c2743d49b599e852c5741ac82bf6634bacfc46 100755
--- a/logger.c
+++ b/logger.c
@@ -231,7 +231,7 @@ int reload_logger(int rotate)
 		    for(x=0;;x++) {
 		      snprintf(new, sizeof(new), "%s/%s.%d", (char *)ast_config_AST_LOG_DIR,f->fn,x);
 		      myf = fopen((char *)new, "r");
-		      if(f) 
+		      if(myf) 
 					fclose(myf);
 		      else
 					break;