summaryrefslogtreecommitdiff
path: root/source3/lib/netapi
diff options
context:
space:
mode:
authorGünther Deschner <gd@samba.org>2008-09-05 23:21:58 +0200
committerGünther Deschner <gd@samba.org>2008-09-08 10:17:06 +0200
commita828a644d0054117cffca02c29b33bdeb1296982 (patch)
treeed54df8d9b63d0419dc6f2db6b4d7deb54b56580 /source3/lib/netapi
parent9194109e6c05a482ba63d97a11cd2b286ac3bfbe (diff)
downloadsamba-a828a644d0054117cffca02c29b33bdeb1296982.tar.gz
samba-a828a644d0054117cffca02c29b33bdeb1296982.tar.bz2
samba-a828a644d0054117cffca02c29b33bdeb1296982.zip
netapi: re-arrange a little NetLocalGroupSetMembers example code.
Guenther (This used to be commit 84a25e69947c077623165fe4535cddd48aba0a3e)
Diffstat (limited to 'source3/lib/netapi')
-rw-r--r--source3/lib/netapi/examples/localgroup/localgroup_setmembers.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/source3/lib/netapi/examples/localgroup/localgroup_setmembers.c b/source3/lib/netapi/examples/localgroup/localgroup_setmembers.c
index acee5cd9c6..c35f2bbb81 100644
--- a/source3/lib/netapi/examples/localgroup/localgroup_setmembers.c
+++ b/source3/lib/netapi/examples/localgroup/localgroup_setmembers.c
@@ -40,6 +40,7 @@ int main(int argc, const char **argv)
uint32_t level = 3;
const char **names = NULL;
int i = 0;
+ size_t buf_size = 0;
poptContext pc;
int opt;
@@ -85,8 +86,9 @@ int main(int argc, const char **argv)
switch (level) {
case 0:
- status = NetApiBufferAllocate(sizeof(struct LOCALGROUP_MEMBERS_INFO_0) * total_entries,
- (void **)&g0);
+ buf_size = sizeof(struct LOCALGROUP_MEMBERS_INFO_0) * total_entries;
+
+ status = NetApiBufferAllocate(buf_size, (void **)&g0);
if (status) {
printf("NetApiBufferAllocate failed with: %s\n",
libnetapi_get_error_string(ctx, status));
@@ -103,8 +105,9 @@ int main(int argc, const char **argv)
buffer = (uint8_t *)g0;
break;
case 3:
- status = NetApiBufferAllocate(sizeof(struct LOCALGROUP_MEMBERS_INFO_3) * total_entries,
- (void **)&g3);
+ buf_size = sizeof(struct LOCALGROUP_MEMBERS_INFO_3) * total_entries;
+
+ status = NetApiBufferAllocate(buf_size, (void **)&g3);
if (status) {
printf("NetApiBufferAllocate failed with: %s\n",
libnetapi_get_error_string(ctx, status));
@@ -133,6 +136,8 @@ int main(int argc, const char **argv)
libnetapi_get_error_string(ctx, status));
}
+ NetApiBufferFree(buffer);
+
out:
libnetapi_free(ctx);
poptFreeContext(pc);