Comments (4)
@aloisklink I had a look at the function and it seems that it has one memory leak and possibility to free a memory region which is not supposed to be freed by the uwrt_lookup_package
.
Memory leek :)
Line 76 in a3bcd1b
struct uci_type_list
causing a memory leak
Freeing a pointer which is not supposed to be freed:
Line 110 in a3bcd1b
The pointer is freed here:
Line 236 in a3bcd1b
Solution memory leak:
Add a sys_free(ti)
here
Line 107 in a3bcd1b
and remove the below line (no idea why is the purpose of it)
Line 113 in a3bcd1b
Solution for freeing the wrong pointer:
Replace the below line with
Line 110 in a3bcd1b
ret = sys_strdup(s->e.name)
from edgesec.
Memory leek :)
(Unfortunately, the Unicodeยฎ consortium rejected all three proposals for a leek emoji, so instead I have to combine
Solution memory leak
Your solution sounds good! Feel free to make a PR (although use os_free
or just plain free()
instead of sys_free()
)!
Freeing a pointer which is not supposed to be freed:
Actually, I don't think this is an issue. In the function uci_lookup_section_ref()
, you don't need to free()
the return value. Instead, you need to free(*typestr)
;
E.g. this is how I believe the function needs to be used:
char *malloced_memory = NULL;
const char *return_value = uci_lookup_section_ref(A, B, &malloced_memory);
free(malloced_memory); // only allocated if need be
I can make a PR that documents this behaviour.
from edgesec.
Feel free to make PR.
from edgesec.
and remove the below line (no idea why is the purpose of it)
Line 113 in a3bcd1b
I've figured out the purpose of it (see PR #485 for a fix!)
Basically, if you call this function again with a different section that has the same type
as a previous UCI section, it should print @section_name[0]
, @section_name[1]
, @section_name[2]
, ...:
But since we weren't saving the increment, it was always doing @section_name[0]
, @section_name[0]
, @section_name[0]
(0 each time!).
from edgesec.
Related Issues (20)
- Eloop termination HOT 1
- Version badge HOT 5
- dockerfile HOT 1
- Debian package HOT 2
- Cleanup docs folder
- Licence and tool rename
- Remove netmon command HOT 1
- Remove the issuer_mac_addr from ticket structure HOT 2
- Remove quarantineVlanId HOT 1
- Documentation missing a preset for TARGET=aarch64-linux-musl HOT 1
- edgesec binary produced for TARGET=aarch64-linux-musl fails to run HOT 12
- Intermittent failing CI due to `Failed to execute statement: disk I/O error` HOT 3
- Failing CI builds due to automake version mismatch
- src/ap/ap_service.c code-coverage is inconsistent HOT 4
- `os_get_reltime` returns actual time, not relative time HOT 2
- Enable GitHub PR Merge Queues for this project. HOT 3
- Running `ctest` in parallel may cause `test_dnsmasq` to fail due to SIGHUP
- `tests/test_edgesec.c` code-coverage is inconsistent HOT 1
- Enable `codespell` to automatically check for spelling mistakes
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. ๐๐๐
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google โค๏ธ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from edgesec.