From 814acf7a6f893e77a714dee4e4b1cd1882001b28 Mon Sep 17 00:00:00 2001
From: Yu Watanabe <watanabe.yu+github@gmail.com>
Date: Sat, 26 Nov 2022 09:57:16 +0900
Subject: [PATCH] sd-netlink: fix segfault

(cherry picked from commit 766417bd763db913efdd9c48442b1094c23d7042)
(cherry picked from commit 25050101780f95c27ebf094fca23d665cff5fb8c)

Conflict:NA
Reference:https://github.com/systemd/systemd-stable/commit/814acf7a6f893e77a714dee4e4b1cd1882001b28
---
 src/libsystemd/sd-netlink/sd-netlink.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/libsystemd/sd-netlink/sd-netlink.c b/src/libsystemd/sd-netlink/sd-netlink.c
index e23e2cc163..3c482192a0 100644
--- a/src/libsystemd/sd-netlink/sd-netlink.c
+++ b/src/libsystemd/sd-netlink/sd-netlink.c
@@ -701,7 +701,8 @@ int sd_netlink_read(
                                 return r;
 
                         if (type == NLMSG_DONE) {
-                                *ret = NULL;
+                                if (ret)
+                                        *ret = NULL;
                                 return 0;
                         }
 
-- 
2.33.0

