From patchwork Tue Nov 11 19:47:08 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 409637 X-Patchwork-Delegate: sjg@chromium.org Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from theia.denx.de (theia.denx.de [85.214.87.163]) by ozlabs.org (Postfix) with ESMTP id D9240140139 for ; Wed, 12 Nov 2014 06:47:33 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 393154B9D8; Tue, 11 Nov 2014 20:47:28 +0100 (CET) Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 5PU2ShGBm90P; Tue, 11 Nov 2014 20:47:28 +0100 (CET) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 60C064B9DA; Tue, 11 Nov 2014 20:47:26 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 301424B98E for ; Tue, 11 Nov 2014 20:47:18 +0100 (CET) Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id kIcWC7FpkAvl for ; Tue, 11 Nov 2014 20:47:18 +0100 (CET) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 (only DNSBL check requested) Received: from mail-pa0-f74.google.com (mail-pa0-f74.google.com [209.85.220.74]) by theia.denx.de (Postfix) with ESMTPS id C079D4B902 for ; Tue, 11 Nov 2014 20:47:13 +0100 (CET) Received: by mail-pa0-f74.google.com with SMTP id kx10so1709696pab.1 for ; Tue, 11 Nov 2014 11:47:12 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=YaIBCJaLOBghI81Gy3gWtMIge5g7u66CB4h46/49asI=; b=mr9Gafnr9yOY+vsaNqpr1K+l53U74x8/Jdc4WLgtNh37rWcnqFRsY704yqvkBXr8EP OCGWO4Hp1uxryqyahM1q84MhLH2G2HS+/S0PPMGO45yRif+vG9cc47qSgnJmXuOoBPIQ H0xTyhXF8eNhQe2WYJeY9J0IdrBI2o8lb8DaAXYc6KiwCkOL+wKfbLWNuJWpwETBUxUK yJsQC9iNSR3xW6Bg95bQjB+ooMyZhcNhw67PLpXWEdNZb18e7yu9RtDBqcBPOi9f+RJP 5sNUvlu87CkztktNJz3VSO1J5tA2OLSQ6Egs0m8W99qmpoY7Vm3s+ZMyRE6QQOdddA8N IPlQ== X-Gm-Message-State: ALoCoQlXtRcDwJsxJC4st5zVjzNBxtDfFc9etsHyG2vWDG4nxuXmhqlvz4j/HZluyqGATLHl3zl1 X-Received: by 10.66.90.129 with SMTP id bw1mr30602929pab.2.1415735231970; Tue, 11 Nov 2014 11:47:11 -0800 (PST) Received: from corpmail-nozzle1-1.hot.corp.google.com ([100.108.1.104]) by gmr-mx.google.com with ESMTPS id r6si807812yhg.1.2014.11.11.11.47.11 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 11 Nov 2014 11:47:11 -0800 (PST) Received: from kaki.bld.corp.google.com ([172.29.216.32]) by corpmail-nozzle1-1.hot.corp.google.com with ESMTP id dZIRMvvL.1; Tue, 11 Nov 2014 11:47:11 -0800 Received: by kaki.bld.corp.google.com (Postfix, from userid 121222) id CDD75221004; Tue, 11 Nov 2014 12:47:10 -0700 (MST) From: Simon Glass To: U-Boot Mailing List Date: Tue, 11 Nov 2014 12:47:08 -0700 Message-Id: <1415735228-20277-2-git-send-email-sjg@chromium.org> X-Mailer: git-send-email 2.1.0.rc2.206.gedb03e5 In-Reply-To: <1415735228-20277-1-git-send-email-sjg@chromium.org> References: <1415735228-20277-1-git-send-email-sjg@chromium.org> Subject: [U-Boot] [PATCH 2/2] sandbox: Fix warnings in cpu.c and os.c X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.13 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: u-boot-bounces@lists.denx.de Errors-To: u-boot-bounces@lists.denx.de This fixes the following two problems: cppcheck reports: [arch/sandbox/cpu/start.c:132]: (error) Uninitialized variable: err [arch/sandbox/cpu/os.c:371]: (error) Memory leak: fname Signed-off-by: Simon Glass Reported-by: Wolfgang Denk --- arch/sandbox/cpu/os.c | 1 + arch/sandbox/cpu/start.c | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/arch/sandbox/cpu/os.c b/arch/sandbox/cpu/os.c index 1c4aa3f..f572cae 100644 --- a/arch/sandbox/cpu/os.c +++ b/arch/sandbox/cpu/os.c @@ -367,6 +367,7 @@ int os_dirent_ls(const char *dirname, struct os_dirent_node **headp) done: closedir(dir); + free(fname); return ret; } diff --git a/arch/sandbox/cpu/start.c b/arch/sandbox/cpu/start.c index 53a99ae..656bd75 100644 --- a/arch/sandbox/cpu/start.c +++ b/arch/sandbox/cpu/start.c @@ -130,7 +130,8 @@ static int sandbox_cmdline_cb_memory(struct sandbox_state *state, state->write_ram_buf = true; state->ram_buf_fname = arg; - if (os_read_ram_buf(arg)) { + err = os_read_ram_buf(arg); + if (err) { printf("Failed to read RAM buffer\n"); return err; }