s4:libcli/dgram: make use of socket_address_copy()
authorStefan Metzmacher <metze@samba.org>
Thu, 15 Feb 2024 16:47:45 +0000 (17:47 +0100)
committerStefan Metzmacher <metze@samba.org>
Fri, 5 Apr 2024 12:24:41 +0000 (12:24 +0000)
This avoids talloc_reference...

BUG: https://bugzilla.samba.org/show_bug.cgi?id=15620

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
source4/libcli/dgram/dgramsocket.c

index dc5dd796bc0f8716876d5fb50a7bab8c291ea890..cd0628ac834969f505e427ac35bc8bea098273ba 100644 (file)
@@ -224,8 +224,8 @@ NTSTATUS nbt_dgram_send(struct nbt_dgram_socket *dgmsock,
        req = talloc(dgmsock, struct nbt_dgram_request);
        if (req == NULL) goto failed;
 
-       req->dest = dest;
-       if (talloc_reference(req, dest) == NULL) goto failed;
+       req->dest = socket_address_copy(req, dest);
+       if (req->dest == NULL) goto failed;
 
        ndr_err = ndr_push_struct_blob(&req->encoded, req, packet,
                                      (ndr_push_flags_fn_t)ndr_push_nbt_dgram_packet);