Found by Coverity.
Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Günther Deschner <gd@samba.org>
struct registry_value value;
const char *value_name = info[j].value_name;
struct registry_value value;
const char *value_name = info[j].value_name;
value.type = REG_SZ;
/* although samba replies with sane data in most cases we
value.type = REG_SZ;
/* although samba replies with sane data in most cases we
if (strequal(value_name, SPOOL_REG_PORTNAME)) {
/* although windows uses a multi-sz, we use a sz */
if (strequal(value_name, SPOOL_REG_PORTNAME)) {
/* although windows uses a multi-sz, we use a sz */
- push_reg_sz(mem_ctx, &value.data, SAMBA_PRINTER_PORT_NAME);
+ ok = push_reg_sz(mem_ctx, &value.data, SAMBA_PRINTER_PORT_NAME);
+ if (!ok) {
+ nt_status = NT_STATUS_NO_MEMORY;
+ goto done;
+ }
}
else if (strequal(value_name, SPOOL_REG_UNCNAME)) {
char *unc_name;
}
else if (strequal(value_name, SPOOL_REG_UNCNAME)) {
char *unc_name;
nt_status = NT_STATUS_NO_MEMORY;
goto done;
}
nt_status = NT_STATUS_NO_MEMORY;
goto done;
}
- push_reg_sz(mem_ctx, &value.data, unc_name);
+ ok = push_reg_sz(mem_ctx, &value.data, unc_name);
+ if (!ok) {
+ nt_status = NT_STATUS_NO_MEMORY;
+ goto done;
+ }
free(unc_name);
}
else if (strequal(value_name, SPOOL_REG_URL)) {
free(unc_name);
}
else if (strequal(value_name, SPOOL_REG_URL)) {
#endif
}
else if (strequal(value_name, SPOOL_REG_SERVERNAME)) {
#endif
}
else if (strequal(value_name, SPOOL_REG_SERVERNAME)) {
- push_reg_sz(mem_ctx, &value.data, longname);
+ ok = push_reg_sz(mem_ctx, &value.data, longname);
+ if (!ok) {
+ nt_status = NT_STATUS_NO_MEMORY;
+ goto done;
+ }
}
else if (strequal(value_name, SPOOL_REG_SHORTSERVERNAME)) {
}
else if (strequal(value_name, SPOOL_REG_SHORTSERVERNAME)) {
- push_reg_sz(mem_ctx, &value.data, lp_netbios_name());
+ ok = push_reg_sz(mem_ctx, &value.data, lp_netbios_name());
+ if (!ok) {
+ nt_status = NT_STATUS_NO_MEMORY;
+ goto done;
+ }
}
else {
value.type = info[j].type;
}
else {
value.type = info[j].type;