1
0
mirror of https://github.com/samba-team/samba.git synced 2025-12-09 00:23:50 +03:00

Call PyErr_SetString instead of fprintf to stderr.

Don't clean up talloc and cli_state on close printer.  They will be
destroyed in the handle dealloc function.
This commit is contained in:
Tim Potter
-
parent 39546dd241
commit 4114fe5996

View File

@@ -52,12 +52,15 @@ PyObject *spoolss_openprinter(PyObject *self, PyObject *args, PyObject *kw)
if (!(cli = open_pipe_creds(computer_name, creds,
cli_spoolss_initialise, NULL))) {
fprintf(stderr, "could not initialise cli state\n");
/* Error state set in open_pipe_creds() */
goto done;
}
if (!(mem_ctx = talloc_init())) {
fprintf(stderr, "unable to initialise talloc context\n");
PyErr_SetString(spoolss_error,
"unable to initialise talloc context\n");
goto done;
}
@@ -99,11 +102,6 @@ PyObject *spoolss_closeprinter(PyObject *self, PyObject *args)
result = cli_spoolss_close_printer(hnd->cli, hnd->mem_ctx, &hnd->pol);
/* Cleanup samba stuf */
cli_shutdown(hnd->cli);
talloc_destroy(hnd->mem_ctx);
/* Return value */
Py_INCREF(Py_None);