selinux.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Nicolas Iooss <nicolas.iooss@m4x.org>
To: selinux@vger.kernel.org
Subject: [PATCH 1/2] libsemanage/tests: return when str is NULL
Date: Mon, 30 Sep 2019 22:22:10 +0200	[thread overview]
Message-ID: <20190930202211.781578-1-nicolas.iooss@m4x.org> (raw)

CU_FAIL() does not stop the execution flow.

This issue has been found using Infer static analyzer.

Signed-off-by: Nicolas Iooss <nicolas.iooss@m4x.org>
---
 libsemanage/tests/test_utilities.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/libsemanage/tests/test_utilities.c b/libsemanage/tests/test_utilities.c
index ba995b5ae094..fa3a077f5e92 100644
--- a/libsemanage/tests/test_utilities.c
+++ b/libsemanage/tests/test_utilities.c
@@ -142,6 +142,7 @@ void test_semanage_split_on_space(void)
 	if (!str) {
 		CU_FAIL
 		    ("semanage_split_on_space: unable to perform test, no memory");
+		return;
 	}
 	temp = semanage_split_on_space(str);
 	CU_ASSERT_STRING_EQUAL(temp, "bar    baz");
-- 
2.22.0


             reply	other threads:[~2019-09-30 20:38 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-30 20:22 Nicolas Iooss [this message]
2019-09-30 20:22 ` [PATCH 2/2] libsemanage/tests: check that string pointers are not NULL before comparing them Nicolas Iooss
2019-10-01 19:02   ` Stephen Smalley

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190930202211.781578-1-nicolas.iooss@m4x.org \
    --to=nicolas.iooss@m4x.org \
    --cc=selinux@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).