If an error is returned without zeroing a pre-allocated @info pointer,
then marshalling of the response will fail.
Bug: https://bugzilla.samba.org/show_bug.cgi?id=10984
Signed-off-by: David Disseldorp <ddiss@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
/* that's an [in out] buffer */
if (!r->in.buffer && (r->in.offered != 0)) {
/* that's an [in out] buffer */
if (!r->in.buffer && (r->in.offered != 0)) {
- return WERR_INVALID_PARAM;
+ result = WERR_INVALID_PARAM;
+ goto err_info_free;
}
*r->out.needed = 0;
if (Printer == NULL) {
}
*r->out.needed = 0;
if (Printer == NULL) {
+ result = WERR_BADFID;
+ goto err_info_free;
}
if (!get_printer_snum(p, r->in.handle, &snum, NULL)) {
}
if (!get_printer_snum(p, r->in.handle, &snum, NULL)) {
+ result = WERR_BADFID;
+ goto err_info_free;
}
result = winreg_get_printer_internal(p->mem_ctx,
}
result = winreg_get_printer_internal(p->mem_ctx,
lp_const_servicename(snum),
&info2);
if (!W_ERROR_IS_OK(result)) {
lp_const_servicename(snum),
&info2);
if (!W_ERROR_IS_OK(result)) {
if (!W_ERROR_IS_OK(result)) {
DEBUG(0, ("_spoolss_GetPrinter: failed to construct printer info level %d - %s\n",
r->in.level, win_errstr(result)));
if (!W_ERROR_IS_OK(result)) {
DEBUG(0, ("_spoolss_GetPrinter: failed to construct printer info level %d - %s\n",
r->in.level, win_errstr(result)));
- TALLOC_FREE(r->out.info);
- return result;
}
*r->out.needed = SPOOLSS_BUFFER_UNION(spoolss_PrinterInfo,
}
*r->out.needed = SPOOLSS_BUFFER_UNION(spoolss_PrinterInfo,
r->out.info = SPOOLSS_BUFFER_OK(r->out.info, NULL);
return SPOOLSS_BUFFER_OK(WERR_OK, WERR_INSUFFICIENT_BUFFER);
r->out.info = SPOOLSS_BUFFER_OK(r->out.info, NULL);
return SPOOLSS_BUFFER_OK(WERR_OK, WERR_INSUFFICIENT_BUFFER);
+
+err_info_free:
+ TALLOC_FREE(r->out.info);
+ return result;
}
/********************************************************************
}
/********************************************************************