diff --git a/channels/chan_sip.c b/channels/chan_sip.c
index a6038698fcd102f4aa8c45929f35e935ef699c87..fa146e1a5341065b6ec464f11dd633e53e8929b5 100644
--- a/channels/chan_sip.c
+++ b/channels/chan_sip.c
@@ -10377,10 +10377,12 @@ static int process_sdp(struct sip_pvt *p, struct sip_request *req, int t38action
 		/* Ensure crypto lines are provided where necessary */
 		if (audio && secure_audio && !processed_crypto) {
 			ast_log(LOG_WARNING, "Rejecting secure audio stream without encryption details: %s\n", m);
-			return -1;
+			res = -1;
+			goto process_sdp_cleanup_b;
 		} else if (video && secure_video && !processed_crypto) {
 			ast_log(LOG_WARNING, "Rejecting secure video stream without encryption details: %s\n", m);
-			return -1;
+			res = -1;
+			goto process_sdp_cleanup_b;
 		}
 	}
 
@@ -10689,6 +10691,8 @@ process_sdp_cleanup:
 	if (res) {
 		offered_media_list_destroy(p);
 	}
+
+process_sdp_cleanup_b:
 	ast_rtp_codecs_payloads_destroy(&newtextrtp);
 	ast_rtp_codecs_payloads_destroy(&newvideortp);
 	ast_rtp_codecs_payloads_destroy(&newaudiortp);