From 86a13b97e418a9b06dace463b296f22600ed8b2c Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Fri, 16 Jun 2006 23:26:48 +0000 Subject: r16326: Klocwork #509. Always check return allocs. Jeremy. (This used to be commit 7e397b534a5ca5809facf5aa84acbfb0b8c9a5b4) --- source3/libads/ldap_printer.c | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'source3/libads') diff --git a/source3/libads/ldap_printer.c b/source3/libads/ldap_printer.c index d6ac09d22b..12bf6eec1d 100644 --- a/source3/libads/ldap_printer.c +++ b/source3/libads/ldap_printer.c @@ -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 *)); -- cgit