Handle allocations marked with helpers or notleak() */
| 276 | |
| 277 | /* Handle allocations marked with helpers or notleak() */ |
| 278 | static void call_memleak_helpers(struct htable *memtable, const tal_t *p) |
| 279 | { |
| 280 | const tal_t *i; |
| 281 | |
| 282 | for (i = tal_first(p); i; i = tal_next(i)) { |
| 283 | const char *name = tal_name(i); |
| 284 | |
| 285 | if (name) { |
| 286 | if (strends(name, "struct memleak_helper")) { |
| 287 | const struct memleak_helper *mh = i; |
| 288 | mh->cb(memtable, p); |
| 289 | } else if (strends(name, " **NOTLEAK**") |
| 290 | || strends(name, "_notleak")) { |
| 291 | memleak_ptr(memtable, i); |
| 292 | memleak_scan_obj(memtable, i); |
| 293 | } else if (strends(name, |
| 294 | " **NOTLEAK_IGNORE_CHILDREN**")) { |
| 295 | remove_with_children(memtable, i); |
| 296 | memleak_scan_obj(memtable, i); |
| 297 | } |
| 298 | } |
| 299 | |
| 300 | /* Recurse down looking for "notleak" children */ |
| 301 | call_memleak_helpers(memtable, i); |
| 302 | } |
| 303 | } |
| 304 | |
| 305 | struct htable *memleak_start(const tal_t *ctx) |
| 306 | { |
no test coverage detected