mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-08-21 05:43:48 -07:00
fix: mem leak,
This commit is contained in:
parent
99101e56fd
commit
ef9d1fa378
1 changed files with 13 additions and 5 deletions
|
@ -123,6 +123,7 @@ serial_port uart_open(const char* pcPortName) {
|
|||
printf("Error: Could not connect\n");
|
||||
freeaddrinfo(addr);
|
||||
free(addrstr);
|
||||
free(sp);
|
||||
return INVALID_SERIAL_PORT;
|
||||
}
|
||||
|
||||
|
@ -132,7 +133,11 @@ serial_port uart_open(const char* pcPortName) {
|
|||
sp->fd = sfd;
|
||||
|
||||
int one = 1;
|
||||
setsockopt(sp->fd, SOL_TCP, TCP_NODELAY, &one, sizeof(one));
|
||||
int res = setsockopt(sp->fd, SOL_TCP, TCP_NODELAY, &one, sizeof(one));
|
||||
if ( res != 0) {
|
||||
free(sp);
|
||||
return INVALID_SERIAL_PORT;
|
||||
}
|
||||
return sp;
|
||||
}
|
||||
|
||||
|
@ -359,8 +364,11 @@ bool uart_set_speed(serial_port sp, const uint32_t uiPortSpeed) {
|
|||
# endif
|
||||
default: return false;
|
||||
};
|
||||
|
||||
struct termios ti;
|
||||
if (tcgetattr(spu->fd,&ti) == -1) return false;
|
||||
if (tcgetattr(spu->fd,&ti) == -1)
|
||||
return false;
|
||||
|
||||
// Set port speed (Input and Output)
|
||||
cfsetispeed(&ti, stPortSpeed);
|
||||
cfsetospeed(&ti, stPortSpeed);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue