pcp
[Top] [All Lists]

[pcp] Memory leak detected by Valgrind (#56)

To: performancecopilot/pcp <pcp@xxxxxxxxxxxxxxxxxx>
Subject: [pcp] Memory leak detected by Valgrind (#56)
From: e03213ac <notifications@xxxxxxxxxx>
Date: Fri, 11 Dec 2015 14:17:41 -0800
Authentication-results: i-otc1esa.syd1.mail-filtering.com.au; spf=Pass smtp.mailfrom=noreply@xxxxxxxxxx; spf=None smtp.helo=postmaster@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Delivered-to: pcp@xxxxxxxxxxx
Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=github.com; s=pf2014; t=1449872261; bh=UcuY5k5fbjUVVtBSDJVKsDjpgoL0bGtvEgLXwcnMJlE=; h=From:Reply-To:To:Subject:List-ID:List-Archive:List-Post: List-Unsubscribe:From; b=xnmz7J1copqqT9FKxRUruFrK+ZgjYrlGCElCv8CcVvuvzrVEKYup7lXLFpQnzv+2N G3qkqLS+H6ZV6hEaBbfF9FrP5j1wYrHw98StVAlZ4p4ktcYIU/QyXfU5F078m0t29O /xXSUC4YxsCfg977kFQFMpYw5uPiGWyrNVBN6GfU=
Ironport-phdr: 9a23:2k8MYx/jrMlsAv9uRHKM819IXTAuvvDOBiVQ1KB50ewcTK2v8tzYMVDF4r011RmSDduds6oMotGVmp6jcFRI2YyGvnEGfc4EfD4+ouJSoTYdBtWYA1bwNv/gYn9yNs1DUFh44yPzahANS47AblHf6ke/8SQVUk2mc1EleKKtQsb7tIee6aObw9XreQJGhT6wM/tZDS6dikHvjPQQmpZoMa0ryxHE8TNicuVSwn50dxrIx06vrpT4wZh47i4Fvvsg89JHA7j8ZLkyDuQABjh+Y2pr7pHi6hOeFAbTtiNMWz9KzUcWWFLIthzwAZ3/6iWh6rAi1iLBY5X8HOFuUjr6t/8zEEew0X5dZ2Vh/DGK25Z51fwKqx/5+EAlktbaaqmPOeJ6b+XSfM8aWGAHVcFUBBFHGZ62OosTE/Iab6EfoIjhp0YE6xC5AE6qA//uxD5Dj2P32qshlPknChzMxwc6HtgD913w9PTpLrgpAby49bD3yi/tXfVciS/W4arWLzcMju+RXqktae2J7GcgHiHdvHDMhp61EGnG6uNYq2WB4e16UOupgGMsrBlwpj+zgd8nksGdnokN4lbD7yhhxJdzKtykSFNxJ9WjFc0DjSyCM5pKRZY6Tntmvzw/w7sNtJW8ZCkOz4hg3xXHI6idfpCM81G7DOydeWdy2ng5ce212k+/rRj4muSmCpbpjg0Qo3BImIbGuCgDjECJtcaMEaUl9Bbwgz2Bj1iLsrkceRltz/qAc5Jxn+9qn8NN4E/ORnCqwhSugqW+bEg8/vnu5OX7Yqjs4JSbMtknpBv5N/EjwpflWL8xOUBaWW+H+Oq937T//Er/W51Fj+E2j6Ofu5ffc5dI7pWlChNYh95woy20CC2rhYwV
List-archive: https://github.com/performancecopilot/pcp
List-id: performancecopilot/pcp <pcp.performancecopilot.github.com>
List-post: <mailto:reply+00bd08b6b4a7b51e4808a2475632e2eb7bf0f3427fc360b992cf0000000112830d8592a169ce074290fb@reply.github.com>
List-unsubscribe: <mailto:unsub+00bd08b6b4a7b51e4808a2475632e2eb7bf0f3427fc360b992cf0000000112830d8592a169ce074290fb@reply.github.com>, <https://github.com/notifications/unsubscribe/AL0ItrwS84eQqWorFZnb8pCaJv5OEGvuks5pO0MFgaJpZM4Gz8G2>
Reply-to: performancecopilot/pcp <reply+00bd08b6b4a7b51e4808a2475632e2eb7bf0f3427fc360b992cf0000000112830d8592a169ce074290fb@xxxxxxxxxxxxxxxx>

This Valgrind error was generated on 3108 but it also applies to the latest master branch:

==109671== 5 bytes in 1 blocks are definitely lost in loss record 1 of 6
==109671==    at 0x4C27A2E: malloc (vg_replace_mallocc:270)
==109671==    by 0x505ACB3: DecodeNameReq (p_pmnsc:519)
==109671==    by 0x4E37247: __pmdaMainPDU (mainloopc:232)
==109671==    by 0x4E378C7: pmdaMain (mainloopc:428)
==109671==    by 0x402A34: main (fbit_mainc:271)

The problem is in src/libpcp_pmda/src/mainloopc, line 232:

if ((sts = __pmDecodeChildReq(pb, &name, &subtype)) >= 0) {

The name string is not freed

Suggested patch:

diff --git a/src/libpcp_pmda/src/mainloopc b/src/libpcp_pmda/src/mainloopc
index 5dff1a9b900b72 100644
--- a/src/libpcp_pmda/src/mainloopc
+++ b/src/libpcp_pmda/src/mainloopc
@@ -243,6 +243,7 @@ __pmdaMainPDU(pmdaInterface *dispatch)
                /* Not INTERFACE_4 */
                sts = PM_ERR_NAME;
            }
+           free(name);
        }
        if (sts < 0)
            __pmSendError(pmda->e_outfd, FROM_ANON, sts);


Reply to this email directly or view it on GitHub.

<Prev in Thread] Current Thread [Next in Thread>