1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-26 10:04:02 +03:00

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>
This commit is contained in:
Stefan Metzmacher 2014-02-26 20:16:26 +01:00 committed by Andrew Bartlett
parent 18c19d51d1
commit 59394b3682

View File

@ -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);