From f6071a90c723e95ed040231aa84b30e87e41e726 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Mon, 13 Mar 2006 21:11:15 +0000 Subject: r14345: Fix Coverity #71. We don't currently propagate *any* alloc error back up the stack from smbldap_set_mod() so ensure we abort correctly. Jeremy. (This used to be commit 9a1e35079af9404e1775e2a098990277b3771086) --- source3/lib/smbldap.c | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) (limited to 'source3/lib/smbldap.c') diff --git a/source3/lib/smbldap.c b/source3/lib/smbldap.c index 327c5a7c4d..a81829b331 100644 --- a/source3/lib/smbldap.c +++ b/source3/lib/smbldap.c @@ -408,8 +408,9 @@ ATTRIB_MAP_ENTRY sidmap_attr_list[] = { if (mods == NULL) { mods = SMB_MALLOC_P(LDAPMod *); if (mods == NULL) { - DEBUG(0, ("make_a_mod: out of memory!\n")); - return; + smb_panic("smbldap_set_mod: out of memory!\n"); + /* notreached. */ + abort(); } mods[0] = NULL; } @@ -422,13 +423,15 @@ ATTRIB_MAP_ENTRY sidmap_attr_list[] = { if (mods[i] == NULL) { mods = SMB_REALLOC_ARRAY (mods, LDAPMod *, i + 2); if (mods == NULL) { - DEBUG(0, ("make_a_mod: out of memory!\n")); - return; + smb_panic("smbldap_set_mod: out of memory!\n"); + /* notreached. */ + abort(); } mods[i] = SMB_MALLOC_P(LDAPMod); if (mods[i] == NULL) { - DEBUG(0, ("make_a_mod: out of memory!\n")); - return; + smb_panic("smbldap_set_mod: out of memory!\n"); + /* notreached. */ + abort(); } mods[i]->mod_op = modop; mods[i]->mod_values = NULL; @@ -446,13 +449,15 @@ ATTRIB_MAP_ENTRY sidmap_attr_list[] = { mods[i]->mod_values = SMB_REALLOC_ARRAY(mods[i]->mod_values, char *, j + 2); if (mods[i]->mod_values == NULL) { - DEBUG (0, ("make_a_mod: Memory allocation failure!\n")); - return; + smb_panic("smbldap_set_mod: out of memory!\n"); + /* notreached. */ + abort(); } if (push_utf8_allocate(&utf8_value, value) == (size_t)-1) { - DEBUG (0, ("make_a_mod: String conversion failure!\n")); - return; + smb_panic("smbldap_set_mod: String conversion failure!\n"); + /* notreached. */ + abort(); } mods[i]->mod_values[j] = utf8_value; -- cgit