Commit 52a6e23
authored
fix(agent): Fix nr_header_create_distributed_trace_map mem leak when hashmap is destroyed (#1017)
This function created a new hashmap, but didn's pass the string dtor in
so any strdupped values were not being freed when the hashmap was
destroyed.
valgrind output from a multiverse run showed:
==220== by 0x6AA4680: nr_strdup (util_memory.c:156)
==220== by 0x6A83BD3: nr_header_create_distributed_trace_map
(nr_header.c:60)
==220== by 0x6A45D28: nr_php_amqplib_retrieve_dt_headers
(lib_php_amqplib.c:503)
==220== by 0x6A45D28: nr_rabbitmq_basic_get (lib_php_amqplib.c:742)
==220== by 0x6A74993: nr_zend_call_orig_execute_special
(php_user_instrument.c:105)
==220== by 0x6A52EAA: nr_php_instrument_func_end (php_execute.c:2086)
==220== by 0x6A54D5B: nr_php_observer_fcall_end (php_execute.c:2188)
==220== by 0x71D7ED: zend_observer_fcall_end (in /usr/local/bin/php)
==220== by 0x6E79FF: execute_ex (in /usr/local/bin/php)
==220== by 0x6F0B42: zend_execute (in /usr/local/bin/php)
==220== by 0x67C06F: zend_execute_scripts (in /usr/local/bin/php)
==220== by 0x60FA3D: php_execute_script (in /usr/local/bin/php)
after applying the fix, valgrind had no issues.1 parent b0184fd commit 52a6e23
2 files changed
+72
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
48 | 48 | | |
49 | 49 | | |
50 | 50 | | |
51 | | - | |
| 51 | + | |
| 52 | + | |
52 | 53 | | |
53 | 54 | | |
54 | 55 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1702 | 1702 | | |
1703 | 1703 | | |
1704 | 1704 | | |
| 1705 | + | |
| 1706 | + | |
| 1707 | + | |
| 1708 | + | |
| 1709 | + | |
| 1710 | + | |
| 1711 | + | |
| 1712 | + | |
| 1713 | + | |
| 1714 | + | |
| 1715 | + | |
| 1716 | + | |
| 1717 | + | |
| 1718 | + | |
| 1719 | + | |
| 1720 | + | |
| 1721 | + | |
| 1722 | + | |
| 1723 | + | |
| 1724 | + | |
| 1725 | + | |
| 1726 | + | |
| 1727 | + | |
| 1728 | + | |
| 1729 | + | |
| 1730 | + | |
| 1731 | + | |
| 1732 | + | |
| 1733 | + | |
| 1734 | + | |
| 1735 | + | |
| 1736 | + | |
| 1737 | + | |
| 1738 | + | |
| 1739 | + | |
| 1740 | + | |
| 1741 | + | |
| 1742 | + | |
| 1743 | + | |
| 1744 | + | |
| 1745 | + | |
| 1746 | + | |
| 1747 | + | |
| 1748 | + | |
| 1749 | + | |
| 1750 | + | |
| 1751 | + | |
| 1752 | + | |
| 1753 | + | |
| 1754 | + | |
| 1755 | + | |
| 1756 | + | |
| 1757 | + | |
| 1758 | + | |
| 1759 | + | |
| 1760 | + | |
| 1761 | + | |
| 1762 | + | |
| 1763 | + | |
| 1764 | + | |
| 1765 | + | |
| 1766 | + | |
| 1767 | + | |
| 1768 | + | |
| 1769 | + | |
| 1770 | + | |
| 1771 | + | |
| 1772 | + | |
| 1773 | + | |
1705 | 1774 | | |
1706 | 1775 | | |
1707 | 1776 | | |
| |||
1721 | 1790 | | |
1722 | 1791 | | |
1723 | 1792 | | |
| 1793 | + | |
1724 | 1794 | | |
0 commit comments