projects
/
oweals
/
nmrpflash.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
8f5a628
)
Fix potential memory leak on Windows
author
Joseph C. Lehner
<joseph.c.lehner@gmail.com>
Sat, 19 Nov 2016 19:19:45 +0000
(20:19 +0100)
committer
Joseph C. Lehner
<joseph.c.lehner@gmail.com>
Sat, 19 Nov 2016 19:19:45 +0000
(20:19 +0100)
ethsock.c
patch
|
blob
|
history
diff --git
a/ethsock.c
b/ethsock.c
index d086e03da59b0a3ae669a3faeea8a39d86299cc4..3219a0dfa20085b05b4f2d8fc6e45fc48c819ae0 100644
(file)
--- a/
ethsock.c
+++ b/
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;