Skip to content
This repository was archived by the owner on Dec 29, 2025. It is now read-only.
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 8 additions & 9 deletions ncsock/get_sitemap_xml.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,15 @@ int get_sitemap_xml(const char* ip, const int port, const int timeout_ms)
}

int result = send_http_request(ip, port, timeout_ms, &hh, response_buffer, 4096);
if (result == -1) {
free(response_buffer);
}

int code = parse_http_response_code(response_buffer);
if (code == 200) {
free(response_buffer);
return 0;
}

// Move the free operation to the end of the function
// Only free memory once, regardless of the result
free(response_buffer);
return -1;

if (result == -1 || code != 200) {
return -1;
}

return 0;
}