Index: kernel/generic/src/ipc/irq.c
===================================================================
--- kernel/generic/src/ipc/irq.c	(revision 05641a9edbf1f7a46db1517a8e99aa0ffa7bdd5d)
+++ kernel/generic/src/ipc/irq.c	(revision b014e9f8dfc796df22c985c021ea0869071a9d5a)
@@ -292,11 +292,12 @@
 		list_remove(&irq->notif_cfg.link);
 		
+		/* Free up the pseudo code and associated structures. */
+		code_free(irq->notif_cfg.code);
+		
+		spinlock_unlock(&irq->lock);
+		
 		/* Remove from the hash table. */
 		hash_table_remove(&irq_uspace_hash_table, key, 2);
 		
-		/* Free up the pseudo code and associated structures. */
-		code_free(irq->notif_cfg.code);
-		
-		spinlock_unlock(&irq->lock);
 		free(irq);
 	}
