fix: close forgotten open file descriptors for recvfile and sendfile
This commit is contained in:
parent
3c603fef22
commit
f50e5c42b4
@ -35,11 +35,12 @@ bool lm_mptp_sendfile(int sock, struct sockaddr *addr, char *path){
|
|||||||
lm_mptp_init(&packet, false, MPTP_S2C_COOL, false);
|
lm_mptp_init(&packet, false, MPTP_S2C_COOL, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
fclose(file);
|
|
||||||
lm_mptp_init(&packet, false, MPTP_S2C_COOL, true);
|
lm_mptp_init(&packet, false, MPTP_S2C_COOL, true);
|
||||||
ret = true;
|
ret = true;
|
||||||
|
|
||||||
end:
|
end:
|
||||||
|
if(NULL != file)
|
||||||
|
fclose(file);
|
||||||
lm_mptp_server_send(sock, &packet, addr);
|
lm_mptp_server_send(sock, &packet, addr);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
@ -85,6 +86,7 @@ bool lm_mptp_recvfile(int sock, char *path){
|
|||||||
|
|
||||||
ret = true;
|
ret = true;
|
||||||
end:
|
end:
|
||||||
fclose(file);
|
if(NULL != file)
|
||||||
|
fclose(file);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user