summaryrefslogtreecommitdiff
path: root/source4/librpc/ndr/ndr_basic.c
diff options
context:
space:
mode:
Diffstat (limited to 'source4/librpc/ndr/ndr_basic.c')
-rw-r--r--source4/librpc/ndr/ndr_basic.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/source4/librpc/ndr/ndr_basic.c b/source4/librpc/ndr/ndr_basic.c
index b8f2a8115f..a9cfb558f7 100644
--- a/source4/librpc/ndr/ndr_basic.c
+++ b/source4/librpc/ndr/ndr_basic.c
@@ -485,8 +485,13 @@ _PUBLIC_ NTSTATUS ndr_push_full_ptr(struct ndr_push *ndr, const void *p)
{
uint32_t ptr = 0;
if (p) {
- ndr->ptr_count++;
- ptr = ndr->ptr_count;
+ /* Check if the pointer already exists and has an id */
+ ptr = ndr_token_peek(&ndr->full_ptr_list, p);
+ if (ptr == 0) {
+ ndr->ptr_count++;
+ ptr = ndr->ptr_count;
+ ndr_token_store(ndr, &ndr->full_ptr_list, p, ptr);
+ }
}
return ndr_push_uint32(ndr, NDR_SCALARS, ptr);
}