Opened 8 years ago
Closed 2 years ago
#851 closed Bug / Defect ( fixed )
Memory leakage
| Reported by: | laowei | Owned by: | plaisthos |
|---|---|---|---|
| Priority: | major | Milestone: | release 2.5 |
| Component: | Generic / unclassified | Version: | OpenVPN git master branch (Community Ed) |
| Severity: | Not set (select this one, unless your'e a OpenVPN developer) | Keywords: | |
| Cc: | plai |
Description
In init.c file, line 1577, if c->c1.tuntap is not NULL, the code doesn't free the memory. do_init_tun will alloc new memory for c->c1.tuntap.
#ifdef TARGET_ANDROID
/* If we emulate persist-tun on android we still have to open a new tun and
* then close the old */
int oldtunfd = -1;
if (c->c1.tuntap)
{
oldtunfd = c->c1.tuntap->fd;
}
#endif
/* initialize (but do not open) tun/tap object */
do_init_tun(c);
Change History (6)
comment:1 Changed 8 years ago by
| Cc: | plai added |
|---|
comment:3 Changed 7 years ago by
I am just looking again on this since I am not sure if this was fixed or not.
I am not sure what would not be freed in that case. And the current code around oldtunfd is a different but I also see no memory leak there. Keep in mind that fd is just an int and need to special free() call to release the memory.
comment:4 Changed 7 years ago by
Sorry misread where the leak is going to happen. I am preparing a patch for this.
comment:5 Changed 2 years ago by
| Owner: | set to plaisthos |
|---|---|
| Status: | new → assigned |
comment:6 Changed 2 years ago by
| Milestone: | → release 2.5 |
|---|---|
| Resolution: | → fixed |
| Status: | assigned → closed |
Fixed in commit da3f583f30a4b2be9cc5501874373fc4f627158d
this is only relevant on TARGET_ANDROID, as for #ifndef TARGET_ANDROID, that whole branch is conditional on
if (!c->c1.tuntap) {... so maybe just free()ing inside the #ifdef block above? @plai?