From 4a468ab3e4633484f093e5f13b24c991a4edee9c Mon Sep 17 00:00:00 2001
From: Marsman1996 <lqliuyuwei@outlook.com>
Date: Tue, 2 Apr 2024 17:03:04 +0800
Subject: [PATCH] dlt_jnpr_ether_cleanup: check config before cleanup

---
 src/tcpedit/plugins/dlt_jnpr_ether/jnpr_ether.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/tcpedit/plugins/dlt_jnpr_ether/jnpr_ether.c b/src/tcpedit/plugins/dlt_jnpr_ether/jnpr_ether.c
index c53ec297..beee9210 100644
--- a/src/tcpedit/plugins/dlt_jnpr_ether/jnpr_ether.c
+++ b/src/tcpedit/plugins/dlt_jnpr_ether/jnpr_ether.c
@@ -164,7 +164,7 @@ dlt_jnpr_ether_cleanup(tcpeditdlt_t *ctx)
         jnpr_ether_config_t *config;
 
         config = (jnpr_ether_config_t *)ctx->encoder->config;
-        if (config->subctx != NULL)
+        if (config != NULL && config->subctx != NULL)
             tcpedit_dlt_cleanup(config->subctx);
         safe_free(plugin->config);
         plugin->config = NULL;