conn->connect_or_select_db.l = database.l;
conn->connect_or_select_db.s = mnd_pestrndup(database.s, conn->connect_or_select_db.l, conn->persistent);
- if (!conn->username.s || !conn->password.s|| !conn->connect_or_select_db.s) {
- SET_OOM_ERROR(conn->error_info);
- goto err; /* OOM */
- }
-
if (!unix_socket && !named_pipe) {
conn->hostname.s = mnd_pestrndup(hostname.s, hostname.l, conn->persistent);
- if (!conn->hostname.s) {
- SET_OOM_ERROR(conn->error_info);
- goto err; /* OOM */
- }
conn->hostname.l = hostname.l;
{
char *p;
}
conn->host_info = mnd_pestrdup(p, conn->persistent);
mnd_sprintf_free(p);
- if (!conn->host_info) {
- SET_OOM_ERROR(conn->error_info);
- goto err; /* OOM */
- }
}
} else {
conn->unix_socket.s = mnd_pestrdup(socket_or_pipe.s, conn->persistent);
SET_OOM_ERROR(conn->error_info);
goto err; /* OOM */
}
- conn->host_info = mnd_pestrdup(p, conn->persistent);
+ conn->host_info = mnd_pestrdup(p, conn->persistent);
mnd_sprintf_free(p);
- if (!conn->host_info) {
- SET_OOM_ERROR(conn->error_info);
- goto err; /* OOM */
- }
} else {
php_error_docref(NULL, E_WARNING, "Impossible. Should be either socket or a pipe. Report a bug!");
}
/* when num_commands is 0, then realloc will be effectively a malloc call, internally */
/* Don't assign to conn->options->init_commands because in case of OOM we will lose the pointer and leak */
new_init_commands = mnd_perealloc(conn->options->init_commands, sizeof(char *) * (conn->options->num_commands + 1), conn->persistent);
- if (!new_init_commands) {
- goto oom;
- }
conn->options->init_commands = new_init_commands;
new_command = mnd_pestrdup(value, conn->persistent);
- if (!new_command) {
- goto oom;
- }
conn->options->init_commands[conn->options->num_commands] = new_command;
++conn->options->num_commands;
break;
}
new_charset_name = mnd_pestrdup(value, conn->persistent);
- if (!new_charset_name) {
- goto oom;
- }
if (conn->options->charset_name) {
mnd_pefree(conn->options->charset_name, conn->persistent);
}
case MYSQLND_OPT_AUTH_PROTOCOL:
{
char * new_auth_protocol = value? mnd_pestrdup(value, conn->persistent) : NULL;
- if (value && !new_auth_protocol) {
- goto oom;
- }
if (conn->options->auth_protocol) {
mnd_pefree(conn->options->auth_protocol, conn->persistent);
}
}
conn->m->local_tx_end(conn, this_func, ret);
DBG_RETURN(ret);
-oom:
- SET_OOM_ERROR(conn->error_info);
- conn->m->local_tx_end(conn, this_func, FAIL);
end:
DBG_RETURN(FAIL);
}
if (!conn->options->connect_attr) {
DBG_INF("Initializing connect_attr hash");
conn->options->connect_attr = mnd_pemalloc(sizeof(HashTable), conn->persistent);
- if (!conn->options->connect_attr) {
- goto oom;
- }
zend_hash_init(conn->options->connect_attr, 0, NULL, conn->persistent ? ZVAL_INTERNAL_PTR_DTOR : ZVAL_PTR_DTOR, conn->persistent);
}
DBG_INF_FMT("Adding [%s][%s]", key, value);
}
conn->m->local_tx_end(conn, this_func, ret);
DBG_RETURN(ret);
-oom:
- SET_OOM_ERROR(conn->error_info);
- conn->m->local_tx_end(conn, this_func, FAIL);
end:
DBG_RETURN(FAIL);
}
*/
len = packet->header.size - 1;
packet->info_or_local_file.s = mnd_emalloc(len + 1);
- if (packet->info_or_local_file.s) {
- memcpy(packet->info_or_local_file.s, p, len);
- packet->info_or_local_file.s[len] = '\0';
- packet->info_or_local_file.l = len;
- } else {
- SET_OOM_ERROR(error_info);
- ret = FAIL;
- }
+ memcpy(packet->info_or_local_file.s, p, len);
+ packet->info_or_local_file.s[len] = '\0';
+ packet->info_or_local_file.l = len;
break;
case 0x00:
DBG_INF("UPSERT");
/* Check for additional textual data */
if (packet->header.size > (size_t) (p - buf) && (len = php_mysqlnd_net_field_length(&p))) {
packet->info_or_local_file.s = mnd_emalloc(len + 1);
- if (packet->info_or_local_file.s) {
- memcpy(packet->info_or_local_file.s, p, len);
- packet->info_or_local_file.s[len] = '\0';
- packet->info_or_local_file.l = len;
- } else {
- SET_OOM_ERROR(error_info);
- ret = FAIL;
- }
+ memcpy(packet->info_or_local_file.s, p, len);
+ packet->info_or_local_file.s[len] = '\0';
+ packet->info_or_local_file.l = len;
}
DBG_INF_FMT("affected_rows=%llu last_insert_id=%llu server_status=%u warning_count=%u",
packet->affected_rows, packet->last_insert_id,