diff --git a/proto/ospf/ospf.c b/proto/ospf/ospf.c
index 232f3f6..b143a19 100644
--- a/proto/ospf/ospf.c
+++ b/proto/ospf/ospf.c
@@ -1274,7 +1274,6 @@ ospf_sh_state(struct proto *p, int verbose, int reachable)
 {
   struct proto_ospf *po = (struct proto_ospf *) p;
   struct ospf_lsa_header *cnode = NULL;
-  int num = po->gr->hash_entries;
   unsigned int i, ix, j1, j2, jx;
   u32 last_area = 0xFFFFFFFF;
 
@@ -1288,6 +1287,7 @@ ospf_sh_state(struct proto *p, int verbose, int reachable)
   /* We store interesting area-scoped LSAs in array hea and 
      global-scoped (LSA_T_EXT) LSAs in array hex */
 
+  int num = po->gr->hash_entries;
   struct top_hash_entry *hea[num];
   struct top_hash_entry *hex[verbose ? num : 0];
   struct top_hash_entry *he;
