From 64910fcf0d33a7e6299236bf98f38e1a43c80a4b Mon Sep 17 00:00:00 2001 From: Jarkko Sakkinen Date: Tue, 23 Nov 2010 13:54:31 -0800 Subject: [PATCH] Handle NULL parameter in smack_rule_set_delete() and smack_label_set_delete() properly. --- src/smack_labels.c | 3 +++ src/smack_rules.c | 3 +++ 2 files changed, 6 insertions(+) diff --git a/src/smack_labels.c b/src/smack_labels.c index e02101d..fac18b5 100644 --- a/src/smack_labels.c +++ b/src/smack_labels.c @@ -78,6 +78,9 @@ void smack_label_set_delete(SmackLabelSet handle) { struct smack_label *l, *tmp; + if (handle == NULL) + return; + HASH_ITER(long_name_hh, handle->label_by_long_name, l, tmp) { HASH_DELETE(long_name_hh, handle->label_by_long_name, l); HASH_DELETE(short_name_hh, handle->label_by_short_name, l); diff --git a/src/smack_rules.c b/src/smack_rules.c index 786b46f..d73ff97 100644 --- a/src/smack_rules.c +++ b/src/smack_rules.c @@ -121,6 +121,9 @@ void smack_rule_set_delete(SmackRuleSet handle) struct smack_subject *s; struct smack_object *o; + if (handle == NULL) + return; + while (handle->subjects != NULL) { s = handle->subjects; while (s->objects != NULL) { -- 2.7.4