diff options
author | Jeremy Allison <jra@samba.org> | 2007-04-30 00:48:20 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 12:19:47 -0500 |
commit | 61f95f1f9759383a8b1ffaf7da6100865144156f (patch) | |
tree | 766d0cac06a07659ef8863e9ac347b8213dd455e /source3/rpc_parse/parse_lsa.c | |
parent | 84c37a1fe2f6a30f14a50028457bcafc85a63a41 (diff) | |
download | samba-61f95f1f9759383a8b1ffaf7da6100865144156f.tar.gz samba-61f95f1f9759383a8b1ffaf7da6100865144156f.tar.bz2 samba-61f95f1f9759383a8b1ffaf7da6100865144156f.zip |
r22585: Get us into a consistent state with TALLOC_ZERO_ARRAY also.
Jeremy.
(This used to be commit c622fb8536d955952a0fbf2441a4cb45a9feb9b0)
Diffstat (limited to 'source3/rpc_parse/parse_lsa.c')
-rw-r--r-- | source3/rpc_parse/parse_lsa.c | 47 |
1 files changed, 28 insertions, 19 deletions
diff --git a/source3/rpc_parse/parse_lsa.c b/source3/rpc_parse/parse_lsa.c index cbbba7f3e9..ea249dc560 100644 --- a/source3/rpc_parse/parse_lsa.c +++ b/source3/rpc_parse/parse_lsa.c @@ -740,9 +740,13 @@ static BOOL lsa_io_dom_query_2(const char *desc, DOM_QUERY_2 *d_q, prs_struct *p return False; if (UNMARSHALLING(ps)) { - d_q->auditsettings = TALLOC_ZERO_ARRAY(ps->mem_ctx, uint32, d_q->count2); - if (!d_q->auditsettings) { - return False; + if (d_q->count2) { + d_q->auditsettings = TALLOC_ZERO_ARRAY(ps->mem_ctx, uint32, d_q->count2); + if (!d_q->auditsettings) { + return False; + } + } else { + d_q->auditsettings = NULL; } } @@ -1121,16 +1125,16 @@ static void init_lsa_sid_enum(TALLOC_CTX *mem_ctx, LSA_SID_ENUM *sen, /* Allocate memory for sids and sid pointers */ - if (num_entries == 0) return; - - if ((sen->ptr_sid = TALLOC_ZERO_ARRAY(mem_ctx, uint32, num_entries )) == NULL) { - DEBUG(3, ("init_lsa_sid_enum(): out of memory for ptr_sid\n")); - return; - } + if (num_entries) { + if ((sen->ptr_sid = TALLOC_ZERO_ARRAY(mem_ctx, uint32, num_entries )) == NULL) { + DEBUG(3, ("init_lsa_sid_enum(): out of memory for ptr_sid\n")); + return; + } - if ((sen->sid = TALLOC_ZERO_ARRAY(mem_ctx, DOM_SID2, num_entries)) == NULL) { - DEBUG(3, ("init_lsa_sid_enum(): out of memory for sids\n")); - return; + if ((sen->sid = TALLOC_ZERO_ARRAY(mem_ctx, DOM_SID2, num_entries)) == NULL) { + DEBUG(3, ("init_lsa_sid_enum(): out of memory for sids\n")); + return; + } } /* Copy across SIDs and SID pointers */ @@ -1566,14 +1570,19 @@ void init_q_lookup_names(TALLOC_CTX *mem_ctx, LSA_Q_LOOKUP_NAMES *q_l, q_l->num_entries2 = num_names; q_l->lookup_level = 1; - if ((q_l->uni_name = TALLOC_ZERO_ARRAY(mem_ctx, UNISTR2, num_names)) == NULL) { - DEBUG(3, ("init_q_lookup_names(): out of memory\n")); - return; - } + if (num_names) { + if ((q_l->uni_name = TALLOC_ZERO_ARRAY(mem_ctx, UNISTR2, num_names)) == NULL) { + DEBUG(3, ("init_q_lookup_names(): out of memory\n")); + return; + } - if ((q_l->hdr_name = TALLOC_ZERO_ARRAY(mem_ctx, UNIHDR, num_names)) == NULL) { - DEBUG(3, ("init_q_lookup_names(): out of memory\n")); - return; + if ((q_l->hdr_name = TALLOC_ZERO_ARRAY(mem_ctx, UNIHDR, num_names)) == NULL) { + DEBUG(3, ("init_q_lookup_names(): out of memory\n")); + return; + } + } else { + q_l->uni_name = NULL; + q_l->hdr_name = NULL; } for (i = 0; i < num_names; i++) { |