Hello,

Add missing default branches to switch statemets.

This should help little bit with uninitialized memory usage.

This patch should go to branches v3 and master.

--
Petr^2 Spacek

From c6e2339e1cb6aefe1ad7899eccc416d746e67f3e Mon Sep 17 00:00:00 2001
From: Petr Spacek <pspa...@redhat.com>
Date: Fri, 6 Dec 2013 15:39:12 +0100
Subject: [PATCH] Add missing default branches to switch statemets.

This should help little bit with uninitialized memory usage.

Signed-off-by: Petr Spacek <pspa...@redhat.com>
---
 src/ldap_helper.c |  6 ++++++
 src/settings.c    | 16 ++++++++++++++++
 2 files changed, 22 insertions(+)

diff --git a/src/ldap_helper.c b/src/ldap_helper.c
index c9da18d75a77fa549ff5e337d1fb89d204e4399e..b5ac5aebf6412e5604695e3f84900494ed1d384b 100644
--- a/src/ldap_helper.c
+++ b/src/ldap_helper.c
@@ -2315,6 +2315,12 @@ force_reconnect:
 						   ldap_sasl_interact,
 						   ldap_inst);
 		break;
+	case AUTH_INVALID:
+		UNEXPECTED_ERROR(__FILE__, __LINE__,
+				"invalid auth_method_enum value %u",
+				 auth_method_enum);
+		break;
+
 	default:
 		log_bug("unsupported authentication mechanism");
 		ret = LDAP_OTHER;
diff --git a/src/settings.c b/src/settings.c
index ceb525e5a949086a9486b4c70882f11c5ebe2030..f29329fb4ad6374378f3537ae99bd24f4074ca6b 100644
--- a/src/settings.c
+++ b/src/settings.c
@@ -183,6 +183,10 @@ setting_get(const char *const name, const setting_type_t type,
 	case ST_BOOLEAN:
 		*(isc_boolean_t *)target = setting->value.value_boolean;
 		break;
+	default:
+		UNEXPECTED_ERROR(__FILE__, __LINE__,
+				 "invalid setting_type_t value %u", type);
+		break;
 	}
 
 	return ISC_R_SUCCESS;
@@ -277,6 +281,10 @@ set_value(isc_mem_t *mctx, setting_t *setting, const char *value,
 		    setting->value.value_boolean == ISC_TF(numeric_value))
 			CLEANUP_WITH(ISC_R_IGNORE);
 		break;
+	default:
+		UNEXPECTED_ERROR(__FILE__, __LINE__,
+				 "invalid setting_type_t value %u", setting->type);
+		break;
 	}
 
 	/* Switch to single thread mode and write new value. */
@@ -300,6 +308,10 @@ set_value(isc_mem_t *mctx, setting_t *setting, const char *value,
 	case ST_BOOLEAN:
 		setting->value.value_boolean = ISC_TF(numeric_value);
 		break;
+	default:
+		UNEXPECTED_ERROR(__FILE__, __LINE__,
+				 "invalid setting_type_t value %u", setting->type);
+		break;
 	}
 	setting->filled = 1;
 	result = ISC_R_SUCCESS;
@@ -387,6 +399,10 @@ setting_unset(const char *const name, const settings_set_t *set,
 	case ST_UNSIGNED_INTEGER:
 	case ST_BOOLEAN:
 		break;
+	default:
+		UNEXPECTED_ERROR(__FILE__, __LINE__,
+				 "invalid setting_type_t value %u", setting->type);
+		break;
 	}
 	setting->filled = 0;
 
-- 
1.8.3.1

_______________________________________________
Freeipa-devel mailing list
Freeipa-devel@redhat.com
https://www.redhat.com/mailman/listinfo/freeipa-devel

Reply via email to