r16326: Klocwork #509. Always check return allocs.
authorJeremy Allison <jra@samba.org>
Fri, 16 Jun 2006 23:26:48 +0000 (23:26 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 16:17:33 +0000 (11:17 -0500)
Jeremy.
(This used to be commit 7e397b534a5ca5809facf5aa84acbfb0b8c9a5b4)

source3/libads/ldap_printer.c

index d6ac09d22bda5db4404917d44f3ddc64eafb3291..12bf6eec1dfc4486616606601ae7ff0be230c100 100644 (file)
@@ -119,6 +119,9 @@ static BOOL map_dword(TALLOC_CTX *ctx, ADS_MODLIST *mods,
        if (value->type != REG_DWORD)
                return False;
        str_value = talloc_asprintf(ctx, "%d", *((uint32 *) value->data_p));
+       if (!str_value) {
+               return False;
+       }
        status = ads_mod_str(ctx, mods, value->valuename, str_value);
        return ADS_ERR_OK(status);
 }
@@ -136,6 +139,9 @@ static BOOL map_bool(TALLOC_CTX *ctx, ADS_MODLIST *mods,
                return False;
        str_value =  talloc_asprintf(ctx, "%s", 
                                     *(value->data_p) ? "TRUE" : "FALSE");
+       if (!str_value) {
+               return False;
+       }
        status = ads_mod_str(ctx, mods, value->valuename, str_value);
        return ADS_ERR_OK(status);
 }
@@ -162,6 +168,9 @@ static BOOL map_multi_sz(TALLOC_CTX *ctx, ADS_MODLIST *mods,
 
        if (num_vals) {
                str_values = TALLOC_ARRAY(ctx, char *, num_vals + 1);
+               if (!str_values) {
+                       return False;
+               }
                memset(str_values, '\0', 
                       (num_vals + 1) * sizeof(char *));