Skip to content

Commit

Permalink
Avoid copy addresses array
Browse files Browse the repository at this point in the history
  • Loading branch information
estringana committed Jan 24, 2025
1 parent 76a43d0 commit 1ee08fa
Showing 1 changed file with 2 additions and 16 deletions.
18 changes: 2 additions & 16 deletions appsec/src/extension/ddappsec.c
Original file line number Diff line number Diff line change
Expand Up @@ -498,23 +498,9 @@ static PHP_FUNCTION(datadog_appsec_push_addresses)
return;
}

zend_array *parameters_arr =
zend_new_array(zend_hash_num_elements(addresses));
zval parameters_zv;
ZVAL_ARR(&parameters_zv, parameters_arr);

zend_string *key;
zval *value;
ZEND_HASH_FOREACH_STR_KEY_VAL(addresses, key, value)
{
if (!key) {
continue;
}

zend_hash_add(Z_ARRVAL(parameters_zv), key, value);
Z_TRY_ADDREF_P(value);
}
ZEND_HASH_FOREACH_END();
ZVAL_ARR(&parameters_zv, addresses);
Z_TRY_ADDREF_P(&parameters_zv);

dd_conn *conn = dd_helper_mgr_cur_conn();
if (conn == NULL) {
Expand Down

0 comments on commit 1ee08fa

Please sign in to comment.