nat: Fail more early in the case of not being authenticated

This is also fixing a possible memory leak.
diff --git a/openbsc/src/nat/bsc_nat.c b/openbsc/src/nat/bsc_nat.c
index 52b3f01..6295ed4 100644
--- a/openbsc/src/nat/bsc_nat.c
+++ b/openbsc/src/nat/bsc_nat.c
@@ -368,10 +368,17 @@
 	struct bsc_connection *found_bsc = NULL;
 	struct bsc_nat_parsed *parsed;
 
+	if (!bsc->authenticated) {
+		LOGP(DNAT, LOGL_ERROR, "BSC is not authenticated.\n");
+		msgb_free(msg);
+		return -1;
+	}
+
 	/* Parse and filter messages */
 	parsed = bsc_nat_parse(msg);
 	if (!parsed) {
 		LOGP(DNAT, LOGL_ERROR, "Can not parse msg from BSC.\n");
+		msgb_free(msg);
 		return -1;
 	}
 
@@ -411,11 +418,6 @@
 		goto exit2;
 	}
 
-	if (!bsc->authenticated) {
-		LOGP(DNAT, LOGL_ERROR, "BSC is not authenticated.\n");
-		goto exit2;
-	}
-
 	/* send the non-filtered but maybe modified msg */
 	if (write_queue_enqueue(&msc_con->write_queue, msg) != 0) {
 		LOGP(DNAT, LOGL_ERROR, "Can not queue message for the MSC.\n");