Repository navigation
Commit 37e1091
committed
data: fix memory leak when reading anydata values
lyd_any_value_str() returns a string allocated by libyang, and the
caller must free it. value() copies it into a python string but never
frees it, so each call leaks the printed content.
Free it after the copy. With a 10 kB anyxml value read 10000 times,
the RSS growth is:
before: 97812 kB
after: 0 kB
Fixes: 806be4c ("Port to libyang 2")
Signed-off-by: Samuel Gauthier <samuel.gauthier@6wind.com>1 parent bd2bb52 commit 37e1091
1 file changed
Lines changed: 8 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1175 | 1175 | | |
1176 | 1176 | | |
1177 | 1177 | | |
1178 | | - | |
| 1178 | + | |
| 1179 | + | |
| 1180 | + | |
| 1181 | + | |
1179 | 1182 | | |
1180 | 1183 | | |
1181 | 1184 | | |
| |||
1186 | 1189 | | |
1187 | 1190 | | |
1188 | 1191 | | |
1189 | | - | |
| 1192 | + | |
| 1193 | + | |
| 1194 | + | |
| 1195 | + | |
1190 | 1196 | | |
1191 | 1197 | | |
1192 | 1198 | | |
| |||
0 commit comments