lldpad/backport-lldptool-fix-null-pointer-deference.patch

33 lines
892 B
Diff
Raw Permalink Normal View History

From 32a19025bcaa705590c536f801a85e1e57d42942 Mon Sep 17 00:00:00 2001
From: gaoxingwang <gxw94linux@163.com>
Date: Wed, 26 Oct 2022 15:23:30 +0800
Subject: [PATCH] lldptool: fix null pointer deference
---
weak_readline.c | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/weak_readline.c b/weak_readline.c
index 6b14f07..2d8da46 100644
--- a/weak_readline.c
+++ b/weak_readline.c
@@ -80,10 +80,14 @@ void using_history(void)
void close_history(void)
{
if (inited) {
- dlclose(rl_handle);
- rl_handle = NULL;
- dlclose(hist_handle);
- hist_handle = NULL;
+ if (rl_handle) {
+ dlclose(rl_handle);
+ rl_handle = NULL;
+ }
+ if (hist_handle) {
+ dlclose(hist_handle);
+ hist_handle = NULL;
+ }
}
}