fix: close forgotten open file descriptors for recvfile and sendfile

This commit is contained in:
ngn 2024-07-01 06:54:44 +03:00
parent 3c603fef22
commit f50e5c42b4

View File

@ -35,11 +35,12 @@ bool lm_mptp_sendfile(int sock, struct sockaddr *addr, char *path){
lm_mptp_init(&packet, false, MPTP_S2C_COOL, false);
}
fclose(file);
lm_mptp_init(&packet, false, MPTP_S2C_COOL, true);
ret = true;
end:
if(NULL != file)
fclose(file);
lm_mptp_server_send(sock, &packet, addr);
return ret;
}
@ -85,6 +86,7 @@ bool lm_mptp_recvfile(int sock, char *path){
ret = true;
end:
fclose(file);
if(NULL != file)
fclose(file);
return ret;
}