Skip to content

Commit b8e6402

Browse files
committed
chore(agent): remove unnecessary use of nr_strdup
1 parent bb7fed8 commit b8e6402

File tree

1 file changed

+4
-11
lines changed

1 file changed

+4
-11
lines changed

agent/php_api.c

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -173,29 +173,22 @@ PHP_FUNCTION(newrelic_notice_error) {
173173
}
174174

175175
if (!determine) {
176-
char* buf = nr_strndup(errormsgstr, errormsglen);
177176
char* stack_json = nr_php_backtrace_to_json(NULL TSRMLS_CC);
178177

179-
nr_txn_record_error(NRPRG(txn), priority, true, buf, errclass, stack_json);
178+
nr_txn_record_error(NRPRG(txn), priority, true, errormsgstr, errclass,
179+
stack_json);
180180

181-
nr_free(buf);
182181
nr_free(stack_json);
183182

184183
RETURN_TRUE;
185184
}
186185
if (determine) {
187-
char* buf1 = nr_strndup(errormsgstr, errormsglen);
188-
char* buf2 = nr_strndup(error_file, error_file_len);
189-
char* buf3 = nr_strndup(error_context, error_context_len);
190186
char* stack_json = nr_php_backtrace_to_json(NULL TSRMLS_CC);
191187

192188
nr_txn_record_error_with_additional_attributes(
193-
NRPRG(txn), priority, true, buf1, errclass, buf2,
194-
error_line, buf3, error_number, stack_json);
189+
NRPRG(txn), priority, true, errormsgstr, errclass, error_file,
190+
error_line, error_context, error_number, stack_json);
195191

196-
nr_free(buf1);
197-
nr_free(buf2);
198-
nr_free(buf3);
199192
nr_free(stack_json);
200193

201194
RETURN_TRUE;

0 commit comments

Comments
 (0)