Changeset 82dc7d35bbaadf8d6f995fa74cd2135e6764188d
- Timestamp:
- 10/19/11 01:27:04
(2 years ago)
- Author:
- Theo Schlossnagle <jesus@omniti.com>
- git-committer:
- Theo Schlossnagle <jesus@omniti.com> 1318987624 -0400
- git-parent:
[cd621c2ce13e17f28a2aa89767ff1a14fe787306]
- git-author:
- Theo Schlossnagle <jesus@omniti.com> 1318987624 -0400
- Message:
These are all memory leak fixes.
They are low priority leaks as they only happen at boot and
only consititue a one-time loss of 200 bytes or so on my box.
Cleanliness is cleanliness.
-
Files:
-
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
| rb1133af |
r82dc7d3 |
|
| 575 | 575 | } \ |
|---|
| 576 | 576 | } while(0) |
|---|
| 577 | | #define RETURN_INT(L, func) do { \ |
|---|
| | 577 | #define RETURN_INT(L, func, expr) do { \ |
|---|
| 578 | 578 | int base = lua_gettop(L); \ |
|---|
| 579 | 579 | assert(base == 1); \ |
|---|
| … | … | |
| 582 | 582 | rv = lua_tointeger(L, -1); \ |
|---|
| 583 | 583 | lua_pop(L, 1); \ |
|---|
| | 584 | expr \ |
|---|
| 584 | 585 | return rv; \ |
|---|
| 585 | 586 | } \ |
|---|
| … | … | |
| 596 | 597 | noit_lua_setup_module(L, mod); |
|---|
| 597 | 598 | noit_lua_hash_to_table(L, options); |
|---|
| | 599 | noit_hash_destroy(options, free, free); |
|---|
| | 600 | free(options); |
|---|
| 598 | 601 | lua_pcall(L, 2, 1, 0); |
|---|
| 599 | 602 | |
|---|
| 600 | | RETURN_INT(L, "config"); |
|---|
| | 603 | /* If rv == 0, the caller will free options. We've |
|---|
| | 604 | * already freed options, that would be bad. fudge -> 1 */ |
|---|
| | 605 | RETURN_INT(L, "config", { rv = (rv == 0) ? 1 : rv; }); |
|---|
| 601 | 606 | return -1; |
|---|
| 602 | 607 | } |
|---|
| … | … | |
| 609 | 614 | lua_pcall(L, 1, 1, 0); |
|---|
| 610 | 615 | |
|---|
| 611 | | RETURN_INT(L, "init"); |
|---|
| | 616 | RETURN_INT(L, "init", ); |
|---|
| 612 | 617 | return -1; |
|---|
| 613 | 618 | } |
|---|
| r87107a8 |
r82dc7d3 |
|
| 392 | 392 | } |
|---|
| 393 | 393 | free(bundle.metrics); |
|---|
| | 394 | free(bundle.status); |
|---|
| 394 | 395 | return rv; |
|---|
| 395 | 396 | } |
|---|
| r2357078 |
r82dc7d3 |
|
| 307 | 307 | strlcat(infile, path, PATH_MAX); |
|---|
| 308 | 308 | } |
|---|
| | 309 | xmlFree(path); |
|---|
| 309 | 310 | config_include_nodes[i].doc = xmlParseFile(infile); |
|---|
| 310 | 311 | if(config_include_nodes[i].doc) { |
|---|
| … | … | |
| 460 | 461 | snprintf(xpath_expr, sizeof(xpath_expr), "//*[@id=\"%s\"]", inheritid); |
|---|
| 461 | 462 | noit_conf_get_into_hash(NULL, xpath_expr, table); |
|---|
| | 463 | xmlFree(inheritid); |
|---|
| 462 | 464 | } |
|---|
| 463 | 465 | /* 3. */ |
|---|
| re2ae3ee |
r82dc7d3 |
|
| 509 | 509 | continue; |
|---|
| 510 | 510 | } |
|---|
| 511 | | config = noit_conf_get_hash(sections[i], "config"); |
|---|
| 512 | 511 | if(module->config) { |
|---|
| 513 | 512 | int rv; |
|---|
| | 513 | config = noit_conf_get_hash(sections[i], "config"); |
|---|
| 514 | 514 | rv = module->config(module, config); |
|---|
| 515 | 515 | if(rv == 0) { |
|---|