diff options
author | Stefan Metzmacher <metze@samba.org> | 2014-02-26 20:16:26 +0100 |
---|---|---|
committer | Andrew Bartlett <abartlet@samba.org> | 2014-04-02 09:03:42 +0200 |
commit | 59394b36820d1f31354f61ebdc376b7fe080ab1e (patch) | |
tree | ac207ce02f25fba05fd162948e32018c976fc61b /source3/lib | |
parent | 18c19d51d1ae0597ab61e7da755c99df4ff86942 (diff) | |
download | samba-59394b36820d1f31354f61ebdc376b7fe080ab1e.tar.gz samba-59394b36820d1f31354f61ebdc376b7fe080ab1e.tar.xz samba-59394b36820d1f31354f61ebdc376b7fe080ab1e.zip |
s3:lib/netapi/examples: fix invalid pointer value warnings in getjoininformation.c
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Diffstat (limited to 'source3/lib')
-rw-r--r-- | source3/lib/netapi/examples/join/getjoininformation.c | 11 |
1 files 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 <http://www.gnu.org/licenses/>. */ +#include "replace.h" #include <string.h> #include <stdio.h> #include <sys/types.h> @@ -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); |