From patchwork Sun Feb 18 12:46:08 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tobias Schramm X-Patchwork-Id: 874861 X-Patchwork-Delegate: blogic@openwrt.org Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (helo) smtp.helo=arrakis.dune.hu (client-ip=78.24.191.176; helo=arrakis.dune.hu; envelope-from=openwrt-devel-bounces@lists.openwrt.org; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="HGuOsyqn"; dkim-atps=neutral Received: from arrakis.dune.hu (arrakis.dune.hu [78.24.191.176]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3zkmrV0Pykz9sWg for ; Sun, 18 Feb 2018 23:48:09 +1100 (AEDT) Received: from arrakis.dune.hu (localhost [127.0.0.1]) by arrakis.dune.hu (Postfix) with ESMTP id CB9EEB91453; Sun, 18 Feb 2018 13:47:06 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on arrakis.dune.hu X-Spam-Level: X-Spam-Status: No, score=-1.5 required=5.0 tests=BAYES_00,FREEMAIL_FROM, T_DKIM_INVALID autolearn=unavailable autolearn_force=no version=3.4.1 Received: from arrakis.dune.hu (localhost [127.0.0.1]) by arrakis.dune.hu (Postfix) with ESMTP; Sun, 18 Feb 2018 13:47:06 +0100 (CET) Received: from arrakis.dune.hu (localhost [127.0.0.1]) by arrakis.dune.hu (Postfix) with ESMTP id CD945B912B3 for ; Sun, 18 Feb 2018 13:46:50 +0100 (CET) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 CL_IP_EQ_HELO_IP=-2 (check from: .gmail. - helo: .mail-lf0-f67.google. - helo-domain: .google.) FROM/MX_MATCHES_HELO(DOMAIN)=-2; rate: -7 Received: from mail-lf0-f67.google.com (mail-lf0-f67.google.com [209.85.215.67]) by arrakis.dune.hu (Postfix) with ESMTPS for ; Sun, 18 Feb 2018 13:46:49 +0100 (CET) Received: by mail-lf0-f67.google.com with SMTP id g72so9631302lfg.5 for ; Sun, 18 Feb 2018 04:46:49 -0800 (PST) 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; bh=ix3RUFbCi2aQVEs1FhWGizNUHjyMwZVL7B4UGCFmIkY=; b=HGuOsyqniQrMKxej+q3hJyE+wuFqXQQuTqVCSe208QoMY6Uh7gArV74IW4jh0RIMij ajojGcqD97moZnPg58DQ0R6F0FD2KUDAl7gmX+aRvKG6QPUg3QtQ3VN0Ao3GbPJO+aZN R+yT7Hj7qrC2i1GxzJyJ4jWOIE2tRgcFm8VOzEjGM7SRLwmnq2nxtuzwREXqmhAAc46k MJUs7ti2jz6gPVwBzCxGALet5rtmjk8buVLdan0d1ClP96bwB93jnoQ9j864XuSUzVYc afoE7lR/atXht5sklNb0DqkQzXdmP5NT2KwYrCGVisn9zVI71CvqKbmEQzGft5bAOpUT un3Q== 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; bh=ix3RUFbCi2aQVEs1FhWGizNUHjyMwZVL7B4UGCFmIkY=; b=n5s311X/VCask2SiNfx2IZL2sj3LbcjxmMvHHRyr7VmhjoQZ76vxyai9HXz0i1ju33 qiqLl5+oPjyl/Qw5sDyWeE65LeLvLEBPzdPMzO7/mkgIpH8Y+lx/UL43aw4pinJti+f4 y60FIYrBO8fjqhfcAj0KcRWRf8Q0/R4gVJO0Kxt1xDVeDxTqTVZxW7t7yjhNMTPGokye uiZNjbSRC4YN5sZdCkKVbvv5iePFOYq+EwsNbR5dgsxvIsNZPhAmBBdOXN90/hBCG9Ev aZpdL/60oq5VK8OaaJhcBz2jiS71C13g4auU9e8CZYa/wGtziSTlgvwZ7s8LM4XTKSMK CcNw== X-Gm-Message-State: APf1xPDiIx9rIuA1NtG1ZK2+m/nY+V3v++LS71/uamRkaXAGtVccJnyK sQonzbLmfwsquyOjKQMGKHtUVT+6 X-Google-Smtp-Source: AH8x226HWzfop3PbOTVhYS6AlaEzLfPJPklCNCfsydGQfQ7rfJWCitgYUZYXbDOC7kHpGuafuzqxQg== X-Received: by 10.25.0.19 with SMTP id 19mr4050456lfa.69.1518958008816; Sun, 18 Feb 2018 04:46:48 -0800 (PST) Received: from sunsetshimmer.lan ([2a02:8108:17c0:1500:f666:aee7:edff:2dfc]) by smtp.gmail.com with ESMTPSA id s1sm3176923ljd.13.2018.02.18.04.46.47 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 18 Feb 2018 04:46:48 -0800 (PST) From: Tobias Schramm To: openwrt-devel@lists.openwrt.org Date: Sun, 18 Feb 2018 13:46:08 +0100 Message-Id: <20180218124610.32692-6-tobleminer@gmail.com> X-Mailer: git-send-email 2.16.1 In-Reply-To: <20180218124610.32692-1-tobleminer@gmail.com> References: <20180218124610.32692-1-tobleminer@gmail.com> Subject: [OpenWrt-Devel] [PATCH v2 5/7] uclient-http: Handle memory allocation failure X-BeenThere: openwrt-devel@lists.openwrt.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: OpenWrt Development List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: openwrt-devel-bounces@lists.openwrt.org Sender: "openwrt-devel" Add null pointer check to allocation of uclient_http struct Signed-off-by: Tobias Schramm --- uclient-http.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/uclient-http.c b/uclient-http.c index 04f16a3..b6607f1 100644 --- a/uclient-http.c +++ b/uclient-http.c @@ -949,6 +949,9 @@ static struct uclient *uclient_http_alloc(void) struct uclient_http *uh; uh = calloc_a(sizeof(*uh)); + if (!uh) + return NULL; + uh->disconnect_t.cb = uclient_http_disconnect_cb; blob_buf_init(&uh->headers, 0);