diff --git a/src/sbbs3/qwktomsg.cpp b/src/sbbs3/qwktomsg.cpp
index 203cb723389e4a9b40e8ed0554dd3f856408da03..1c016206f5c8dab49130f8bbd211f0c1ee6e68a4 100644
--- a/src/sbbs3/qwktomsg.cpp
+++ b/src/sbbs3/qwktomsg.cpp
@@ -455,10 +455,10 @@ bool sbbs_t::qwktomsg(FILE *qwk_fp, char *hdrblk, char fromhub, uint subnum
 					smb_hfield_str(&msg,FIDOREPLYID,remsg.ftn_msgid);
 
 				smb_updatethread(&smb,&remsg,smb.status.last_msg+1);
+				smb_freemsgmem(&remsg);
 			}
 
 			smb_unlockmsghdr(&smb,&remsg);
-			smb_freemsgmem(&remsg);
 		}
 	}