From patchwork Thu Nov 23 14:04:36 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sven Eckelmann X-Patchwork-Id: 17153 X-Patchwork-Delegate: sw@simonwunderlich.de Return-Path: X-Original-To: patchwork@open-mesh.org Delivered-To: patchwork@open-mesh.org Received: from open-mesh.org (localhost [IPv6:::1]) by open-mesh.org (Postfix) with ESMTP id 91B8B80674; Thu, 23 Nov 2017 15:05:20 +0100 (CET) Authentication-Results: open-mesh.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=openmesh-com.20150623.gappssmtp.com header.i=@openmesh-com.20150623.gappssmtp.com header.b="a/ZFbIHK"; dkim-atps=neutral Received-SPF: None (mailfrom) identity=mailfrom; client-ip=2607:f8b0:400d:c09::241; helo=mail-qk0-x241.google.com; envelope-from=sven.eckelmann@openmesh.com; receiver= Received: from mail-qk0-x241.google.com (mail-qk0-x241.google.com [IPv6:2607:f8b0:400d:c09::241]) by open-mesh.org (Postfix) with ESMTPS id 44DE980639 for ; Thu, 23 Nov 2017 15:05:09 +0100 (CET) Received: by mail-qk0-x241.google.com with SMTP id f63so21093053qke.8 for ; Thu, 23 Nov 2017 06:05:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=openmesh-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=xQdc0iUbCaYdNYG4CvcR7IsKX9JmO/AoThxupvwTBnI=; b=a/ZFbIHKZAxgrNJaPfxIhsQTrUbodNO9kUX/cLnu5Fo0s4dmLgM7pRbmdU2cJ0WLO5 xMRR45MYNSfORm3JrtC/fG3JFWXR6X4sYCstl0fkiWMIZX/x8bnNewt6JRJ5DV6isqme BBbeXBVmmtNhyUBEn69WNoaG8+VgTj7M6xZ1yp+Zm77z0oskpIP0oUyrXejSJsPCiz3f jd/VVPiVATfntaqZLdTPxUClqqioPGLYRP1gO5+AwOyPhFsL8GXvYLpi+V2zoFeWrXk3 y+eECPFDruQzMWuNLwOsyn/TC+xrzGEccnd818xCPO4ZrQDShljhmv01IRrVL028Qxn7 EF0Q== 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=xQdc0iUbCaYdNYG4CvcR7IsKX9JmO/AoThxupvwTBnI=; b=mbThEoFFr3aAy9NrRBs5FzyucZQVufQ9Vq+EHnlidWuOZI9jg2sjBaQSAtpUZghI+y 773KAv7rRgUwUNuLKGzyMppl3yBN7xJhR8KZN5D4pt8IwdPFfXn6aZLsR4fkgZYAmxlI 2bZZ8OzZPMksXtTNgit+fxj2fHOTtUe0ajIhxy33edjRZRsNdOe9byIJftcu4ZE8g9hJ 3IfETkc/gm1vVRVOfQFW+e1I8qUed2gRXTtWefZTKvWLhiB0dyPWWrVf8MEMXyRkdEL2 j9sqAcC6tGOpeWsaukNMESK6KinwMRe7c8yTdcO6avBKxJChy5xHCMAsu8oz60Ysj8po BDqA== X-Gm-Message-State: AJaThX6N2UWwujS5VGldIsk3DlGv1AAMcdVJANMI3BTQQe6+rxM7YQsW 8/+IGrTPBpIG2f9zOJ0Ifp8Oyw42 X-Google-Smtp-Source: AGs4zMaco8smOWbd5MZUA8sgBdC/Gefh4+l4u4ZohW0bnEpQi39I7CFibK84HpWVEz7ONx4BnmbEuQ== X-Received: by 10.55.191.135 with SMTP id p129mr17719553qkf.211.1511445908147; Thu, 23 Nov 2017 06:05:08 -0800 (PST) Received: from sven-desktop.home.narfation.org (p2003007C6F53F7FA6FAE965552C91071.dip0.t-ipconnect.de. [2003:7c:6f53:f7fa:6fae:9655:52c9:1071]) by smtp.gmail.com with ESMTPSA id 46sm13171727qtx.65.2017.11.23.06.05.07 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 23 Nov 2017 06:05:07 -0800 (PST) From: Sven Eckelmann To: b.a.t.m.a.n@lists.open-mesh.org Date: Thu, 23 Nov 2017 15:04:36 +0100 Message-Id: <20171123140444.17119-3-sven.eckelmann@openmesh.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20171123140444.17119-1-sven.eckelmann@openmesh.com> References: <20171123140444.17119-1-sven.eckelmann@openmesh.com> Subject: [B.A.T.M.A.N.] [PATCH 02/10] batctl: Handle failure during hash_iterator allocation X-BeenThere: b.a.t.m.a.n@lists.open-mesh.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: The list for a Better Approach To Mobile Ad-hoc Networking List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: The list for a Better Approach To Mobile Ad-hoc Networking Cc: Sven Eckelmann Errors-To: b.a.t.m.a.n-bounces@lists.open-mesh.org Sender: "B.A.T.M.A.N" The iterator functions should not try to start the iteration when the iterator could not be allocated. Signed-off-by: Sven Eckelmann --- hash.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/hash.c b/hash.c index f4a7af7..0e4d1e3 100644 --- a/hash.c +++ b/hash.c @@ -120,6 +120,9 @@ struct hash_it_t *hash_iterate(struct hashtable_t *hash, if (iter_in == NULL) { iter = debugMalloc(sizeof(struct hash_it_t), 301); + if (!iter) + return NULL; + iter->index = -1; iter->bucket = NULL; iter->prev_bucket = NULL;