From patchwork Sat Jul 7 11:20:55 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Andr=C3=A9_Roth?= X-Patchwork-Id: 10512849 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id B98A860532 for ; Sat, 7 Jul 2018 11:21:13 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AB22E2884A for ; Sat, 7 Jul 2018 11:21:13 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9F83728874; Sat, 7 Jul 2018 11:21:13 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4C0472884A for ; Sat, 7 Jul 2018 11:21:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753730AbeGGLVL (ORCPT ); Sat, 7 Jul 2018 07:21:11 -0400 Received: from mail-ed1-f67.google.com ([209.85.208.67]:40213 "EHLO mail-ed1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753486AbeGGLVJ (ORCPT ); Sat, 7 Jul 2018 07:21:09 -0400 Received: by mail-ed1-f67.google.com with SMTP id e19-v6so10443191edq.7 for ; Sat, 07 Jul 2018 04:21:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Ubueexn/qY2cDXEAz3Wg+8CLMMneubkHtdyAs8719Po=; b=BITP4HZQlqbOWVRh9ZfuK70gQ30QptwS/czHZunVpsjtEN5sVTChxlbTzkFC5WyZdY QreFer4cKJEkYGbOlE98zNuLcnx0ksztbfUYXXM5+T14BkF2WZIVjkJhVvSKsHF9n4bN mZdIVQOkkGmEwyUMx3jcyD8A4SJ0sOAS9VBSd8aFSWb8OhLHImrs5YlSGEOEzYlQ4oNb TElFCnEs+o45s+8MkHZT3okI7e+GsIVp/9DUTxVV6rogaNBEJ8q5EJtmV4BP2df3jQ7J kmVhPq0TXjCvsSUpNsxKt/KyMJsf/VinFtk7ypXXnNUuUi9CuEwfW9mNyNTIU6YEHOp8 3bcg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Ubueexn/qY2cDXEAz3Wg+8CLMMneubkHtdyAs8719Po=; b=fqSDnerYN/0xu8SRjFuqDSDJggFoUrSY+yCuct5wbTJgPYWnSw6w4ZNnEe/h+Z3T0Z qFtQ5/jXMSSOhM0Wpx830bc/cqq890g56LxMsUAfdV2+H2t0VW7fD0GRpCNsEuIeSuqs sObd/SJaWcxhGt5Xl7fnv5zOuUYkt/WgdttZexsUr6S126eu7fI3wlZrvRgNdq2OEXhj Rcf1Lw3o/2GUB9Z1oenrr2Cg5CyYfcQDTd7BsFloZCNEUh5RDbyS7bPmaVLNJTu4iqAq 5jU7GyKLCfX3hRK2XWfOnaYdKY/aXUQclvurTawgvVUPPWBIVpvMNizqkmowVwi2C6YQ s+ig== X-Gm-Message-State: APt69E2vMQeg0Z72Fubqq0cNtnxM3hCxs95GfFTlv267JUqLBkT+CXyO 0oewGVXjc3MZeDo6PEp2i8K+WQ== X-Google-Smtp-Source: AAOMgpeonlfWsQZxmHNS24h5/154rI8M+VPkFVAvkCQf2jpmSR3MKewDEMFHJDOICZ/8MmQwNwd0Fg== X-Received: by 2002:aa7:ca14:: with SMTP id y20-v6mr14804531eds.242.1530962468355; Sat, 07 Jul 2018 04:21:08 -0700 (PDT) Received: from localhost.localdomain (247.88.107.92.dynamic.wline.res.cust.swisscom.ch. [92.107.88.247]) by smtp.gmail.com with ESMTPSA id q2-v6sm2239641edl.42.2018.07.07.04.21.07 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 07 Jul 2018 04:21:07 -0700 (PDT) From: =?UTF-8?q?Andr=C3=A9=20Roth?= To: linux-media@vger.kernel.org Cc: =?UTF-8?q?Andr=C3=A9=20Roth?= Subject: [PATCH 2/4] libdvbv5: fix double free in dvb_fe_open_fname Date: Sat, 7 Jul 2018 13:20:55 +0200 Message-Id: <20180707112057.7235-2-neolynx@gmail.com> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20180707112057.7235-1-neolynx@gmail.com> References: <20180707112057.7235-1-neolynx@gmail.com> MIME-Version: 1.0 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Since parms and fname is allocated outside of the function, do not free it. Use dvb_v5_free for freeing parms, it will free fname if required. Signed-off-by: André Roth --- lib/libdvbv5/dvb-fe.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/lib/libdvbv5/dvb-fe.c b/lib/libdvbv5/dvb-fe.c index 7dcfa53e..5dcf492e 100644 --- a/lib/libdvbv5/dvb-fe.c +++ b/lib/libdvbv5/dvb-fe.c @@ -185,7 +185,7 @@ struct dvb_v5_fe_parms *dvb_fe_open_flags(int adapter, int frontend, ret = dvb_fe_open_fname(parms, fname, flags); if (ret < 0) { - free(parms); + dvb_v5_free(parms); return NULL; } @@ -209,9 +209,7 @@ int dvb_fe_open_fname(struct dvb_v5_fe_parms_priv *parms, char *fname, if (xioctl(fd, FE_GET_INFO, &parms->p.info) == -1) { dvb_perror("FE_GET_INFO"); - dvb_v5_free(parms); close(fd); - free(fname); return -errno; } @@ -293,7 +291,6 @@ int dvb_fe_open_fname(struct dvb_v5_fe_parms_priv *parms, char *fname, } if (!parms->p.num_systems) { dvb_logerr(_("delivery system not detected")); - dvb_v5_free(parms); close(fd); return -EINVAL; } @@ -304,7 +301,6 @@ int dvb_fe_open_fname(struct dvb_v5_fe_parms_priv *parms, char *fname, dtv_prop.props = parms->dvb_prop; if (xioctl(fd, FE_GET_PROPERTY, &dtv_prop) == -1) { dvb_perror("FE_GET_PROPERTY"); - dvb_v5_free(parms); close(fd); return -errno; } @@ -314,7 +310,6 @@ int dvb_fe_open_fname(struct dvb_v5_fe_parms_priv *parms, char *fname, if (parms->p.num_systems == 0) { dvb_logerr(_("driver returned 0 supported delivery systems!")); - dvb_v5_free(parms); close(fd); return -EINVAL; }