From patchwork Tue Oct 10 08:37:52 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Storm, Christian" X-Patchwork-Id: 823746 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=googlegroups.com (client-ip=2a00:1450:400c:c09::23a; helo=mail-wm0-x23a.google.com; envelope-from=swupdate+bncbdd6bwv65qpbb5un6lhakgqexyabzna@googlegroups.com; receiver=) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=googlegroups.com header.i=@googlegroups.com header.b="DsHcoKVF"; dkim-atps=neutral Received: from mail-wm0-x23a.google.com (mail-wm0-x23a.google.com [IPv6:2a00:1450:400c:c09::23a]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3yB9Vf68xZz9tY0 for ; Tue, 10 Oct 2017 19:38:17 +1100 (AEDT) Received: by mail-wm0-x23a.google.com with SMTP id i124sf5245513wmf.1 for ; Tue, 10 Oct 2017 01:38:17 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1507624694; cv=pass; d=google.com; s=arc-20160816; b=klHgPpfCiA9ELOIvzIgCbS+rkrytxUOruZ+XyNu99TPmflQ85qYBH4+n7qT/DJCzJ+ qXjqQknVL9Nr1qi6ilXHA3JsthCzLhSxy8hEe0IBx8jW7iM61WjEk5kv9Xy8ZPJBV4Wd fGt7/WCI3n4glHRb3y6w6yaauUWw0mrfO5akR5DanngZDTbFJV0DpMyxEBh8PsozQ6sd 9jwP0c3vUjvSLtu/4IHHndDMMdyfM3q1iH9FH0q35pf21NbBDRkWhfgw//GrLVaTn/Wg zbTSz79nQIL34od4q2/l0GSbBaokuGWX9nfiLPolR9cVYAA7dHe77q+UpLf+CjULKCcy BYKw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post :list-id:mailing-list:precedence:message-id:date:subject:cc:to:from :arc-authentication-results:arc-message-signature:mime-version :sender:dkim-signature:arc-authentication-results; bh=qxjzjgtjCjpFK44P0ZZrg7cDQiPeNm5hJ9xBeOiwzaQ=; b=Zu6xvWrciDxXy5BSXllZGKSwDoAiKufByjb8slJtkW3W6xQjCQi0RVZtp7QQoMzfVp h+81sMQftMO2MBQGNZCq23aupVRuE/DtMfIaTKPizOEcn4a+UI/B7vqPOBw+lzrR/ybV Jq4nqElJADzepnfBrTgZNBzspv3jJAtnIOupUKCRP2enbxwWPCHm6h0TQWyx3mq1pryz e7dYxV2yGLj1yTNzi4yO4ij+JuNJSI84q86rU91tfe8kBkIFrnb2omA3R0QFQ8DlR9sh JLfC020nZNvRDRh1SUsdERq0z4BFo/bAioS/qqSx/KEQPUx4qc5oOKu+MoE1wlNykTbY pHmg== ARC-Authentication-Results: i=2; gmr-mx.google.com; spf=neutral (google.com: 192.35.17.14 is neither permitted nor denied by domain of christian.storm@siemens.com) smtp.mailfrom=christian.storm@siemens.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=20161025; h=sender:mime-version:from:to:cc:subject:date:message-id :x-original-sender:x-original-authentication-results:precedence :mailing-list:list-id:list-post:list-help:list-archive :list-subscribe:list-unsubscribe; bh=qxjzjgtjCjpFK44P0ZZrg7cDQiPeNm5hJ9xBeOiwzaQ=; b=DsHcoKVFvPwu436/7LuNqxM3HwP4V63F9WupksRLVQ46x2JlJ1P4gV6u91/I2x5UOv wHouTcaNLc0Xf3mvunYEZw7UlScn13ocCR5OuEAqlU9h8oo3+epneVOwYlYfcJwVrUCP jyfvrwrAxFs7b+6m+SaSpAc3oXXvVuwyhfsiSQKvPbFUwVwosaSAYvEQ8XRju6m5+ooe ODgGsASx3bvAREgn0VJjKPNSJnuxFVRsVDfAcItJ740m+xdZfVfviFlCqEy/PBhwBzC3 hl0jOwn0wNYt602aSpAIpcI58LxUPxZdPllcI8HG3QBpOfj4XZFPYBHFeo0xs7KEXu0f dQ1w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=sender:x-gm-message-state:mime-version:from:to:cc:subject:date :message-id:x-original-sender:x-original-authentication-results :precedence:mailing-list:list-id:x-spam-checked-in-group:list-post :list-help:list-archive:list-subscribe:list-unsubscribe; bh=qxjzjgtjCjpFK44P0ZZrg7cDQiPeNm5hJ9xBeOiwzaQ=; b=cUSbisG3uldggL+SVNhqskCIDBOo5aTcoA9tswkyJUO59oZepa4cKdKFeXQPbbtfVN XEIKdUWhVbvou52qJszq2BWnrLsZrz/JJTy6j/ZyoqJOp1XWYVOISn3CSXIYA8nDWCut uSNjss6LM94WqIPtOn6QG4qmmfZ/4jXhNjiZR4arHTeFb/EOeAdQgj/1xM7h2BrnxDtw HLFfw7StsFcQ8rWH6O/chzRqFoDgLticBD8t8K/st3rqaRQHuAXw/2Agr6PkmagJoCVu WTphfGGY02UruNt+Zpxclt/7lL5eMLfxMn16NOt76izZhdMsrQlRtQSmqHg4MGw80a+g br4Q== Sender: swupdate@googlegroups.com X-Gm-Message-State: AMCzsaUjWWs+CBfh8mFgBPCy6FIqVIF0hQflB6s/PyS+jcOldFqX8VQW XPfsA+AxkftyKrux0tCtjoM= X-Google-Smtp-Source: AOwi7QBgj/cGJM/hyDEtfI2wOvz4zxRfHAJ8v6bLx4KZtrRhlxZv1y4oquByD+lEMMaFw4sx7VJCug== X-Received: by 10.28.184.132 with SMTP id i126mr29865wmf.14.1507624694327; Tue, 10 Oct 2017 01:38:14 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: swupdate@googlegroups.com Received: by 10.28.146.131 with SMTP id u125ls625434wmd.0.gmail; Tue, 10 Oct 2017 01:38:14 -0700 (PDT) X-Received: by 10.223.152.4 with SMTP id v4mr1027758wrb.19.1507624694079; Tue, 10 Oct 2017 01:38:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1507624694; cv=none; d=google.com; s=arc-20160816; b=jAu4lproqdpnQig62M981GTeZSHXsg4mDZvU3OhS9dO5BhnIvYiEzMr5pOFQJOcYYG ljpUePyw/jt5p2C30+uB/Asm91R5Qkq3yyEip5rWc4lMOeqAI0+5qNVuws9eWDuSnRw9 EHPhYbSKxt4xw41JApMCiarZHy49F+bhKO5rlWgO9+jTgSDy1Ty0XBuoPX9IPFfqDjzC +tDkdKUGbWHInrfKVmMarhqJI+sSIlDGwSYAckO9smaYiAweU5ACLz0c0eO8j61mmA3e tuuCMrkDjF84tqi5wfCUgL99bFhAkpzMwub4ee8bDO99QFPg1xy+sXG9OGDRwMFgEgxx Se1g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=message-id:date:subject:cc:to:from:arc-authentication-results; bh=4Hs30+xzhth2Oplq2a2sTK9fS35xs1p48J+npNluWvQ=; b=QLh0NOX/6i7p8IVVV38FAs4p54j1QUL1+iEBRJtlc+CqsYeg2wYFlPLbVOGJXHxAOi flMlcBr4Qa0bB9hTaEzCDv9AKUr+YAGsy8QKAr6SzEHpD0hoRa1wY7bt8zQyXwSTDHeu 2ANf1rm/Ek2cTcIafc4tso5pOcRAXtMR7ZgpI3vFwtWo6aomFNt43yg9QyxPIgV1TiVL lB7tHnTarWkwhF4ydbO+2o+Coxk2Pzv0BQlLkBqQK524K3pejXRqnCpXSyTdJx+beudN T0Axq7XfVlSQiy6bajrr5VEnB4crzC7mV0eiZAGF2riFRW0me3/Pp2qfYoeDm5Dtb87h z/5Q== ARC-Authentication-Results: i=1; gmr-mx.google.com; spf=neutral (google.com: 192.35.17.14 is neither permitted nor denied by domain of christian.storm@siemens.com) smtp.mailfrom=christian.storm@siemens.com Received: from david.siemens.de (david.siemens.de. [192.35.17.14]) by gmr-mx.google.com with ESMTPS id m74si959827wma.0.2017.10.10.01.38.13 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 10 Oct 2017 01:38:14 -0700 (PDT) Received-SPF: neutral (google.com: 192.35.17.14 is neither permitted nor denied by domain of christian.storm@siemens.com) client-ip=192.35.17.14; Received: from mail1.siemens.de (mail1.siemens.de [139.23.33.14]) by david.siemens.de (8.15.2/8.15.2) with ESMTPS id v9A8cDYb015575 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Tue, 10 Oct 2017 10:38:13 +0200 Received: from MD1KR9XC.ww002.siemens.net ([139.25.69.251]) by mail1.siemens.de (8.15.2/8.15.2) with ESMTP id v9A8cDc2032486; Tue, 10 Oct 2017 10:38:13 +0200 From: Christian Storm To: swupdate@googlegroups.com Cc: Christian Storm Subject: [swupdate] [PATCH] Lua: don't overfree stack in l_register_handler() Date: Tue, 10 Oct 2017 10:37:52 +0200 Message-Id: <20171010083752.7491-1-christian.storm@siemens.com> X-Mailer: git-send-email 2.14.2 X-Original-Sender: christian.storm@siemens.com X-Original-Authentication-Results: gmr-mx.google.com; spf=neutral (google.com: 192.35.17.14 is neither permitted nor denied by domain of christian.storm@siemens.com) smtp.mailfrom=christian.storm@siemens.com Precedence: list Mailing-list: list swupdate@googlegroups.com; contact swupdate+owners@googlegroups.com List-ID: X-Spam-Checked-In-Group: swupdate@googlegroups.com X-Google-Group-Id: 605343134186 List-Post: , List-Help: , List-Archive: , List-Unsubscribe: , luaL_ref() pops from the stack, hence lua_pop() has to clean only one stack item. Signed-off-by: Christian Storm --- corelib/lua_interface.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/corelib/lua_interface.c b/corelib/lua_interface.c index 14f9251..15eae98 100644 --- a/corelib/lua_interface.c +++ b/corelib/lua_interface.c @@ -478,8 +478,8 @@ static int l_register_handler( lua_State *L ) { const char *handler_desc = luaL_checkstring(L, 1); /* store the callback function in registry */ *l_func_ref = luaL_ref (L, LUA_REGISTRYINDEX); - /* pop the arguments from the stack */ - lua_pop (L, 2); + /* cleanup stack */ + lua_pop (L, 1); register_handler(handler_desc, l_handler_wrapper, ANY_HANDLER, l_func_ref); return 0;