From patchwork Mon Dec 30 15:56:51 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paulo Zanoni X-Patchwork-Id: 3419721 Return-Path: X-Original-To: patchwork-intel-gfx@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id CAC5DC02DC for ; Mon, 30 Dec 2013 15:57:30 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 23CE12010E for ; Mon, 30 Dec 2013 15:57:26 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 4866F20109 for ; Mon, 30 Dec 2013 15:57:25 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id AD989FA849; Mon, 30 Dec 2013 07:57:21 -0800 (PST) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mail-qe0-f44.google.com (mail-qe0-f44.google.com [209.85.128.44]) by gabe.freedesktop.org (Postfix) with ESMTP id 422CAFB758 for ; Mon, 30 Dec 2013 07:57:14 -0800 (PST) Received: by mail-qe0-f44.google.com with SMTP id nd7so11508447qeb.17 for ; Mon, 30 Dec 2013 07:57:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=7sPNQDBRtJjcUdtH33LC30q8HJHhazhf77rhLZ7PBu8=; b=TsgGYTf4m4IvuQCaumW6UeSYPD7QuxnvQKNe9Aks5k1Wjr0vRUhwH+eygTeZsJdW9/ 8Y2lOZeJ7iepgHzFYbUZil9jXz9VMzXDZAfIqe5On9BogEW9F5wi9W9+v9NUPfnLXF2K Id6MaR3Ec49wGRf3+n2lfK8xG/vtfn7Z/DKCK4JfhzTBp675I8bfntKZQg0iI8N7x6PS NexJ4aVkj1Yo2Z2ym3xSbgyaet/VGGwe+FQSm/jg4FAweY3fmp/bMLecn0V8qd5b/EFQ 4XNvkvIptHuxBD97Djr5xMPnVuBHkjcWU1a4eTsmi2dkTqRMYHPmLtZr5jdXochL0Atk 6bhw== X-Received: by 10.49.27.8 with SMTP id p8mr111696493qeg.64.1388419033887; Mon, 30 Dec 2013 07:57:13 -0800 (PST) Received: from localhost.localdomain ([187.112.58.219]) by mx.google.com with ESMTPSA id o3sm66129491qak.5.2013.12.30.07.57.12 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 30 Dec 2013 07:57:13 -0800 (PST) From: Paulo Zanoni To: intel-gfx@lists.freedesktop.org Date: Mon, 30 Dec 2013 13:56:51 -0200 Message-Id: <1388419013-17016-4-git-send-email-przanoni@gmail.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1388419013-17016-1-git-send-email-przanoni@gmail.com> References: <1388419013-17016-1-git-send-email-przanoni@gmail.com> Cc: Paulo Zanoni Subject: [Intel-gfx] [PATCH 4/6] tests/kms_flip: don't leak the CRTC X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: intel-gfx-bounces@lists.freedesktop.org Errors-To: intel-gfx-bounces@lists.freedesktop.org X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Paulo Zanoni The kms_flip program calls kmstest_get_connector_config, which returns a struct containing some allocated variables, including a pointer to the CRTC. The problem is that we copy the values returned by this structure to the test_output struct, but we ignore the CRTC pointer. So free the CRTC pointer instead of leaking it. Caught by Valgrind. Signed-off-by: Paulo Zanoni --- tests/kms_flip.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tests/kms_flip.c b/tests/kms_flip.c index 80f4d76..78e179e 100644 --- a/tests/kms_flip.c +++ b/tests/kms_flip.c @@ -921,6 +921,8 @@ static void connector_find_preferred_mode(uint32_t connector_id, int crtc_idx, o->fb_width = o->kmode[0].hdisplay; o->fb_height = o->kmode[0].vdisplay; + + drmModeFreeCrtc(config.crtc); } static bool mode_compatible(const drmModeModeInfo *a, const drmModeModeInfo *b) @@ -986,6 +988,9 @@ found: o->kencoder[1] = config[1].encoder; o->_crtc[1] = config[1].crtc->crtc_id; o->kmode[1] = *mode[1]; + + drmModeFreeCrtc(config[0].crtc); + drmModeFreeCrtc(config[1].crtc); } static void paint_flip_mode(struct kmstest_fb *fb, bool odd_frame)