From patchwork Sun Sep 23 10:00:18 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Hajnoczi X-Patchwork-Id: 186199 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id C03F52C008D for ; Sun, 23 Sep 2012 20:42:35 +1000 (EST) Received: from localhost ([::1]:47040 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TFj0F-0005nl-4c for incoming@patchwork.ozlabs.org; Sun, 23 Sep 2012 06:01:31 -0400 Received: from eggs.gnu.org ([208.118.235.92]:59950) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TFiza-0004ZZ-6F for qemu-devel@nongnu.org; Sun, 23 Sep 2012 06:00:51 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TFizZ-0007ir-4F for qemu-devel@nongnu.org; Sun, 23 Sep 2012 06:00:50 -0400 Received: from mail-wg0-f53.google.com ([74.125.82.53]:39659) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TFizY-0007aL-K7 for qemu-devel@nongnu.org; Sun, 23 Sep 2012 06:00:49 -0400 Received: by mail-wg0-f53.google.com with SMTP id dr1so3090777wgb.10 for ; Sun, 23 Sep 2012 03:00:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references; bh=t3VC5ErpRBi5CI5zO9d/b4oXmsrkinG5gokXLE4fNJ8=; b=ZreRucGkOFwVcrs7naSLB/BFj4iKlhFg/r4VKOoRIeh1wqs+W8DzxcpnpmrOHaA3xG g0fMu8ELiNJvrC/XtpjVTGtyptmzTYte/Bx6g1+wLy8lBBWk5SeW8LtN/GKSbkS+aJna HREf7J4unPc1WkkgyLxCTol4jmQQncpBOZ73sllXY5vQaBI5fuoQwmxHcuNArVGlC8Oz 6TyJDe+PU3eBhDxJq/OcjNqq1ueArY5ZQhi+RLLQx+xpArFO1XKs+fYhWafyL21igQeh 5+iHvakHYeuuqzfpKfsEBq314UM1GglfqS7E2+o12lw8OHDd9aK65YLxb1iFPcsvxjT4 lbQQ== Received: by 10.180.83.66 with SMTP id o2mr7602308wiy.14.1348394448112; Sun, 23 Sep 2012 03:00:48 -0700 (PDT) Received: from localhost ([109.224.133.37]) by mx.google.com with ESMTPS id l5sm9494138wix.5.2012.09.23.03.00.47 (version=TLSv1/SSLv3 cipher=OTHER); Sun, 23 Sep 2012 03:00:47 -0700 (PDT) From: Stefan Hajnoczi To: Anthony Liguori Date: Sun, 23 Sep 2012 11:00:18 +0100 Message-Id: <1348394420-28298-13-git-send-email-stefanha@gmail.com> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1348394420-28298-1-git-send-email-stefanha@gmail.com> References: <1348394420-28298-1-git-send-email-stefanha@gmail.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 74.125.82.53 Cc: Stefan Weil , qemu-devel@nongnu.org, Stefan Hajnoczi Subject: [Qemu-devel] [PATCH 12/14] linux-user: Remove redundant null check and replace free by g_free X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Stefan Weil Report from smatch: linux-user/syscall.c:3632 do_ioctl_dm(220) info: redundant null check on big_buf calling free() 'big_buf' was allocated by g_malloc0, therefore free was also replaced by g_free. Signed-off-by: Stefan Weil Reviewed-by: Peter Maydell Signed-off-by: Stefan Hajnoczi --- linux-user/syscall.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/linux-user/syscall.c b/linux-user/syscall.c index 6257a04..471d060 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -3628,9 +3628,7 @@ static abi_long do_ioctl_dm(const IOCTLEntry *ie, uint8_t *buf_temp, int fd, unlock_user(argptr, arg, target_size); } out: - if (big_buf) { - free(big_buf); - } + g_free(big_buf); return ret; }