summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Hindoe Paaboel Andersen <phomes@gmail.com>2015-05-11 21:41:31 +0200
committerThomas Hindoe Paaboel Andersen <phomes@gmail.com>2015-05-11 21:42:59 +0200
commit86ff9f117300e9fa35bc20bbd13a6671efa70e79 (patch)
treec5abce0480587fbf84660fbb8d37a11fd24e8fa1
parent12322d4100b8bd3d85c81fa4b24692c10a8158c2 (diff)
test-libudev: fix leak in error case
CID# 1297428
-rw-r--r--src/test/test-libudev.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/test/test-libudev.c b/src/test/test-libudev.c
index 6bc77cf899..34c49b969a 100644
--- a/src/test/test-libudev.c
+++ b/src/test/test-libudev.c
@@ -341,8 +341,10 @@ static int test_enumerate(struct udev *udev, const char *subsystem) {
return -1;
udev_enumerate_add_match_subsystem(udev_enumerate,"block");
r = udev_enumerate_add_match_is_initialized(udev_enumerate);
- if (r < 0)
+ if (r < 0) {
+ udev_enumerate_unref(udev_enumerate);
return r;
+ }
udev_enumerate_scan_devices(udev_enumerate);
test_enumerate_print_list(udev_enumerate);
udev_enumerate_unref(udev_enumerate);