Skip to content

Commit 801c23b

Browse files
committed
fix: correct hashmap deletion logic in service.c
1 parent 16cdd9b commit 801c23b

File tree

2 files changed

+2
-12
lines changed

2 files changed

+2
-12
lines changed

src/http_fetch.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -198,8 +198,7 @@ static void http_fetch_remove_from_map(http_fetch_ctx_t *ctx)
198198
/* Remove from hashmap if pipe_fd is valid */
199199
if (fetch_fd_map && ctx->pipe_fd >= 0)
200200
{
201-
http_fetch_ctx_t *temp_ptr = ctx;
202-
hashmap_delete(fetch_fd_map, &temp_ptr);
201+
hashmap_delete(fetch_fd_map, &ctx);
203202
}
204203
}
205204

src/service.c

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1587,16 +1587,7 @@ void service_hashmap_remove(service_t *service)
15871587
return;
15881588
}
15891589

1590-
/* Create a temporary service with the URL to use as search key */
1591-
service_t key_service;
1592-
key_service.url = service->url;
1593-
1594-
const void *removed = hashmap_delete(service_map, &key_service);
1595-
1596-
if (removed == NULL)
1597-
{
1598-
logger(LOG_WARN, "Service URL not found in hashmap: %s", service->url);
1599-
}
1590+
hashmap_delete(service_map, &service);
16001591
}
16011592

16021593
service_t *service_hashmap_get(const char *url)

0 commit comments

Comments
 (0)