If done with popt context it should be free'd.
Signed-off-by: Swen Schillig <swen@linux.ibm.com>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Ralph Böhme <slow@samba.org>
}
done:
+ poptFreeContext(pc);
TALLOC_FREE(mem_ctx);
return ret;
}
}
done:
+ poptFreeContext(pc);
talloc_free(mem_ctx);
return ret;
}
in = fopen(infile, "r");
if(!in) {
perror("fopen");
+ poptFreeContext(pc);
return 1;
}
} else in = stdin;
if(!out) {
perror("fopen");
fprintf(stderr, "Can't find %s, using stdout...\n", outfile);
+ poptFreeContext(pc);
return 1;
}
}
fclose(out);
}
+ poptFreeContext(pc);
return 0;
}
{
int c;
const char *path = NULL;
- poptContext pc;
+ poptContext pc = NULL;
struct poptOption long_options[] = {
POPT_AUTOHELP
{
state.follow_symlink ? 0 : FTW_PHYS);
}
+done:
poptFreeContext(pc);
-done:
TALLOC_FREE(frame);
return ret;
}
if (argc == 1) {
poptPrintHelp(pc, stderr, 0);
+ poptFreeContext(pc);
return 1;
}
if (diagnostics) {
if (!diagnose_ntlm_auth()) {
+ poptFreeContext(pc);
return 1;
}
} else {
fstr_sprintf(user, "%s%c%s", opt_domain, winbind_separator(), opt_username);
if (!check_plaintext_auth(user, opt_password, True)) {
+ poptFreeContext(pc);
return 1;
}
}
checkparms = setparms & ~MASK_ALWAYS_GOOD;
if (checkparms & BIT_FIX_INIT) {
+ poptFreeContext(pc);
return fix_users_list();
}
(checkparms & BIT_EXPORT)) &&
!(checkparms & ~(BIT_IMPORT +BIT_EXPORT +BIT_USER))) {
+ poptFreeContext(pc);
+
if (backend_in) {
status = make_pdb_method_name(&bin, backend_in);
} else {
/* list users operations */
if (checkparms & BIT_LIST) {
if (!(checkparms & ~BIT_LIST)) {
+ poptFreeContext(pc);
return print_users_list(verbose, spstyle);
}
if (!(checkparms & ~(BIT_USER + BIT_LIST))) {
+ poptFreeContext(pc);
return print_user_info(user_name, verbose, spstyle);
}
}
/* check use of -u option */
if (!(checkparms & BIT_USER)) {
fprintf (stderr, "Username not specified! (use -u option)\n");
+ poptFreeContext(pc);
return -1;
}
/* account creation operations */
if (!(checkparms & ~(BIT_CREATE + BIT_USER + BIT_MACHINE))) {
- if (checkparms & BIT_MACHINE) {
+ poptFreeContext(pc);
+ if (checkparms & BIT_MACHINE) {
return new_machine(user_name, machine_sid);
} else {
return new_user(user_name, full_name,
/* account deletion operations */
if (!(checkparms & ~(BIT_DELETE + BIT_USER + BIT_MACHINE))) {
- if (checkparms & BIT_MACHINE) {
+ poptFreeContext(pc);
+ if (checkparms & BIT_MACHINE) {
return delete_machine_entry(user_name);
} else {
return delete_user_entry(user_name);
/* account modification operations */
if (!(checkparms & ~(BIT_MODIFY + BIT_USER + BIT_MACHINE))) {
+ poptFreeContext(pc);
if (checkparms & BIT_MACHINE) {
return set_machine_info(user_name,
account_control,
}
poptPrintHelp(pc, stderr, 0);
+ poptFreeContext(pc);
TALLOC_FREE(frame);
return 1;
}
fprintf(stderr, "Unable to open registry: %s\n",
win_errstr(rv));
TALLOC_FREE(frame);
+ poptFreeContext(pc);
return 1;
}
display_window(frame, ctx);
TALLOC_FREE(frame);
+ poptFreeContext(pc);
return 0;
}
if ( !sid ) {
fprintf( stderr, "Failed to retrieve Machine SID!\n");
- return 3;
+ retval = 3;
+ goto done;
}
printf ("%s\n", dom_sid_str_buf(sid, &buf) );
- return 0;
+ retval = 0;
+ goto done;
}
if ( mode == SMB_ACL_VIEW && force_acl ) {
fprintf( stderr, "Invalid combination of -F and -v\n");
- return -1;
+ retval = -1;
+ goto done;
}
if (mode == SMB_ACL_VIEW_ALL) {
if(!poptPeekArg(pc)) {
poptPrintUsage(pc, stderr, 0);
- return -1;
+ retval = -1;
+ goto done;
}
fstrcpy(sharename, poptGetArg(pc));
if ( snum == -1 && !force_acl ) {
fprintf( stderr, "Invalid sharename: %s\n", sharename);
- return -1;
+ retval = -1;
+ goto done;
}
switch (mode) {
}
done:
+ poptFreeContext(pc);
talloc_destroy(ctx);
return retval;
* shell needs 0. */
ret = !do_command(evt_ctx, msg_ctx, argc, argv);
+
+ poptFreeContext(pc);
TALLOC_FREE(frame);
return ret;
}
fprintf(stderr, "%s: %s\n",
poptBadOption(pc, POPT_BADOPTION_NOALIAS),
poptStrerror(c));
- return 1;
+ ret = 1;
+ goto done;
}
if ((opt.send_stdout || resume || opt.outputfile) && opt.update) {
fprintf(stderr, "The -o, -R or -O and -U options can not be "
"used together.\n");
- return 1;
+ ret = 1;
+ goto done;
}
if ((opt.send_stdout || opt.outputfile) && recursive) {
fprintf(stderr, "The -o or -O and -R options can not be "
"used together.\n");
- return 1;
+ ret = 1;
+ goto done;
}
if (opt.outputfile && opt.send_stdout) {
fprintf(stderr, "The -o and -O options can not be "
"used together.\n");
- return 1;
+ ret = 1;
+ goto done;
}
popt_burn_cmdline_password(argc, argv);
if (smbc_init(get_auth_data, opt.debuglevel) < 0) {
fprintf(stderr, "Unable to initialize libsmbclient\n");
- return 1;
+ ret= 1;
+ goto done;
}
if (smb_encrypt) {
}
}
+done:
+ poptFreeContext(pc);
TALLOC_FREE(frame);
if (ret) {
clean_exit();
/* Now do our stuff */
if (!print_tree(popt_get_cmdline_auth_info())) {
+ poptFreeContext(pc);
TALLOC_FREE(frame);
return 1;
}
popt_free_cmdline_auth_info();
+ poptFreeContext(pc);
TALLOC_FREE(frame);
return 0;
}
printf("[%s]\n", buff);
}
+ poptFreeContext(pc);
talloc_free(ctx);
return 0;
bool show_processes, show_locks, show_shares;
bool show_notify = false;
bool resolve_uids = false;
- poptContext pc;
+ poptContext pc = NULL;
struct poptOption long_options[] = {
POPT_AUTOHELP
{
case 'P':
/* Dump profile data */
ok = status_profile_dump(verbose);
- return ok ? 0 : 1;
+ ret = ok ? 0 : 1;
+ goto done;
case 'R':
/* Continuously display rate-converted data */
ok = status_profile_rates(verbose);
- return ok ? 0 : 1;
+ ret = ok ? 0 : 1;
+ goto done;
default:
break;
}
}
done:
+ poptFreeContext(pc);
TALLOC_FREE(frame);
return ret;
}