From 59394b36820d1f31354f61ebdc376b7fe080ab1e Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Wed, 26 Feb 2014 20:16:26 +0100 Subject: [PATCH] s3:lib/netapi/examples: fix invalid pointer value warnings in getjoininformation.c Signed-off-by: Stefan Metzmacher Reviewed-by: Andrew Bartlett --- source3/lib/netapi/examples/join/getjoininformation.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/source3/lib/netapi/examples/join/getjoininformation.c b/source3/lib/netapi/examples/join/getjoininformation.c index 3db0f4aeb2d..7dac456bf9b 100644 --- a/source3/lib/netapi/examples/join/getjoininformation.c +++ b/source3/lib/netapi/examples/join/getjoininformation.c @@ -17,6 +17,7 @@ * along with this program; if not, see . */ +#include "replace.h" #include #include #include @@ -30,7 +31,8 @@ int main(int argc, const char **argv) { NET_API_STATUS status; const char *host_name = NULL; - const char *name_buffer = NULL; + char *name_buffer = NULL; + const char *p = NULL; uint16_t name_type = 0; struct libnetapi_ctx *ctx = NULL; @@ -62,9 +64,8 @@ int main(int argc, const char **argv) /* NetGetJoinInformation */ - status = NetGetJoinInformation(host_name, - &name_buffer, - &name_type); + status = NetGetJoinInformation(host_name, &p, &name_type); + name_buffer = discard_const_p(char, p); if (status != 0) { printf("failed with: %s\n", libnetapi_get_error_string(ctx, status)); @@ -96,7 +97,7 @@ int main(int argc, const char **argv) } out: - NetApiBufferFree((void *)name_buffer); + NetApiBufferFree(name_buffer); libnetapi_free(ctx); poptFreeContext(pc); -- 2.11.4.GIT