diff --git a/src/mptp/utils.c b/src/mptp/util.c similarity index 96% rename from src/mptp/utils.c rename to src/mptp/util.c index 13e1b62..a3c4530 100644 --- a/src/mptp/utils.c +++ b/src/mptp/util.c @@ -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; }