Skip to content

Commit 532283d

Browse files
committed
Replace malloc() with static varible
1 parent 37116e6 commit 532283d

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

supervisor/shared/web_workflow/web_workflow.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,7 @@ static socketpool_socket_obj_t active;
125125
static _request active_request;
126126

127127
static char _api_password[64];
128+
static char web_instance_name[50];
128129

129130
// Store the encoded IP so we don't duplicate work.
130131
static uint32_t _encoded_ip = 0;
@@ -269,7 +270,6 @@ void supervisor_start_web_workflow(void) {
269270

270271
char ssid[33];
271272
char password[64];
272-
char web_instance_name[50];
273273

274274
os_getenv_err_t result = common_hal_os_getenv_str("CIRCUITPY_WIFI_SSID", ssid, sizeof(ssid));
275275
if (result != GETENV_OK) {
@@ -335,8 +335,7 @@ void supervisor_start_web_workflow(void) {
335335
mdns_server_construct(&mdns, true);
336336
mdns.base.type = &mdns_server_type;
337337
if (!common_hal_mdns_server_deinited(&mdns)) {
338-
char *instance_name = strndup(web_instance_name, strlen(web_instance_name));
339-
common_hal_mdns_server_set_instance_name(&mdns, instance_name);
338+
common_hal_mdns_server_set_instance_name(&mdns, web_instance_name);
340339
}
341340
}
342341
if (!common_hal_mdns_server_deinited(&mdns)) {

0 commit comments

Comments
 (0)