blob: ce0a3f1a540fdbda3ad15fa21b703d0b89598856 [file] [log] [blame] [edit]
From https://github.com/systemd/systemd/commit/70808ac2793dbf66774143bde4f2320bc5281b14.patch
From 70808ac2793dbf66774143bde4f2320bc5281b14 Mon Sep 17 00:00:00 2001
From: Dave Reisner <dreisner@archlinux.org>
Date: Sat, 26 Nov 2016 14:28:35 -0500
Subject: [PATCH] device: Avoid calling unit_free(NULL) in device setup logic
Since a581e45ae8f9bb5c, there's a few function calls to
unit_new_for_name which will unit_free on failure. Prior to this commit,
a failure would result in calling unit_free with a NULL unit, and hit an
assertion failure, seen at least via device_setup_unit:
Assertion 'u' failed at src/core/unit.c:519, function unit_free(). Aborting.
Github issue: #4747
downstream: https://bugs.archlinux.org/task/51950
---
src/core/device.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/core/device.c b/src/core/device.c
index 074e93ffe2..8e2e3c7bed 100644
--- a/src/core/device.c
+++ b/src/core/device.c
@@ -359,7 +359,7 @@ static int device_setup_unit(Manager *m, struct udev_device *dev, const char *pa
fail:
log_unit_warning_errno(u, r, "Failed to set up device unit: %m");
- if (delete)
+ if (delete && u)
unit_free(u);
return r;