← Commit list

59584399a5

x2018
x2018
2025-11-09
SUCCESS Duration: 143s

Subject

tftp: release filename if conn_get_remote_addr fails

Binary

No binary (build failed)

Architecture & Compiler Flags

Architecture: x86_64-linux-gnu Compiler: gcc (Ubuntu 11.4.0-1ubuntu1~22.04.3) 11.4.0

—

Build Log

(log yok)

Commit Diff GitHub →

lib/tftp.c+1 -2
@@ -479,6 +479,7 @@ static CURLcode tftp_send_first(struct tftp_conn *state,
state->blksize,
"%s%c%s%c", filename, '\0', mode, '\0');
sbytes = 4 + strlen(filename) + strlen(mode);
+ free(filename);
/* optional addition of TFTP options */
if(!data->set.tftp_no_options) {
@@ -517,7 +518,6 @@ static CURLcode tftp_send_first(struct tftp_conn *state,
if(result != CURLE_OK) {
failf(data, "TFTP buffer too small for options");
- free(filename);
return CURLE_TFTP_ILLEGAL;
}
}
@@ -537,7 +537,6 @@ static CURLcode tftp_send_first(struct tftp_conn *state,
(SEND_TYPE_ARG3)sbytes, 0,
CURL_SENDTO_ARG5(&remote_addr->curl_sa_addr),
(curl_socklen_t)remote_addr->addrlen);
- free(filename);
if(senddata != (ssize_t)sbytes) {
char buffer[STRERROR_LEN];
failf(data, "%s", curlx_strerror(SOCKERRNO, buffer, sizeof(buffer)));