Fix potential memory leak on Windows
This commit is contained in:
parent
8f5a628b01
commit
b9504f17c8
1 changed files with 6 additions and 6 deletions
12
ethsock.c
12
ethsock.c
|
@ -276,12 +276,6 @@ struct ethsock *ethsock_create(const char *intf, uint16_t protocol)
|
|||
struct ethsock *sock;
|
||||
int err;
|
||||
|
||||
sock = malloc(sizeof(struct ethsock));
|
||||
if (!sock) {
|
||||
perror("malloc");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
#ifdef NMRPFLASH_WINDOWS
|
||||
intf = intf_alias_to_wpcap(intf);
|
||||
if (!intf) {
|
||||
|
@ -289,6 +283,12 @@ struct ethsock *ethsock_create(const char *intf, uint16_t protocol)
|
|||
}
|
||||
#endif
|
||||
|
||||
sock = malloc(sizeof(struct ethsock));
|
||||
if (!sock) {
|
||||
perror("malloc");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
buf[0] = '\0';
|
||||
|
||||
sock->intf = intf;
|
||||
|
|
Loading…
Add table
Reference in a new issue