diff options
author | Sam James <sam@gentoo.org> | 2022-12-05 09:56:41 +0000 |
---|---|---|
committer | William Hubbs <w.d.hubbs@gmail.com> | 2022-12-07 11:35:16 -0600 |
commit | 0525de4f182af8292cd0ce4f4cacc17ea463b8bc (patch) | |
tree | 8a4c8757f25b26936f00d3cb0315b67b69032e33 /src | |
parent | 9380347f042f7d294317f4420b648422817eb75a (diff) |
librc-depend: fix -Wmismatched-dealloc
Despite this being a 'deptree', it's actually
xmalloc'd in the same function (rc_deptree_update),
and so should be free'd, not rc_deptree_free'd,
as rc_deptree_load* wasn't used to allocate it.
```
[71/213] Compiling C object src/librc/librc.so.1.p/librc-depend.c.o
../src/librc/librc-depend.c: In function ‘rc_deptree_update’:
../src/librc/librc-depend.c:1077:9: warning: ‘rc_deptree_free’ called on pointer returned from a mismatched allocation function [-Wmismatched-dealloc]
1077 | rc_deptree_free(deptree);
| ^~~~~~~~~~~~~~~~~~~~~~~~
In file included from ../src/shared/misc.h:29,
from ../src/librc/librc.h:57,
from ../src/librc/librc-depend.c:21:
In function ‘xmalloc’,
inlined from ‘rc_deptree_update’ at ../src/librc/librc-depend.c:775:12:
../src/shared/helpers.h:64:23: note: returned from ‘malloc’
64 | void *value = malloc(size);
| ^~~~~~~~~~~~
```
This fixes #563.
Diffstat (limited to 'src')
-rw-r--r-- | src/librc/librc-depend.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/librc/librc-depend.c b/src/librc/librc-depend.c index 4da81c03..03149a52 100644 --- a/src/librc/librc-depend.c +++ b/src/librc/librc-depend.c @@ -1074,6 +1074,6 @@ rc_deptree_update(void) } rc_stringlist_free(config); - rc_deptree_free(deptree); + free(deptree); return retval; } |