From patchwork Sun Oct 20 11:26:05 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yousong Zhou X-Patchwork-Id: 1179990 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.openwrt.org (client-ip=2607:7c80:54:e::133; helo=bombadil.infradead.org; envelope-from=openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="tVKr+VbA"; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="Of4C3G1j"; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 46wyCR5jzrz9sCJ for ; Sun, 20 Oct 2019 22:26:43 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Subject:MIME-Version:Message-Id:Date:To :From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=FoIv59Ogd+5Ab82bggDBnz/nENGjbasYsHkaZq7taVw=; b=tVKr+VbA0adnIO FZkohGoZtVcYKzLiXd0l1Q1ZqwdF+UwzPBDHxmsiRSVnFCd/FSLo48Ln/8n9AJwflXKZaG/AeWqF6 PAlfCKrmgqh0lBo+EpyijEZSXXAICCo27/aXp1X/jrUksATtEAk+sJr4y5WrHCWjh4ZVzXg4vROwb E4xSElcSB869+fcyqlV9Z5UJChpkVX/8xh5bv6rnJEzVvYwpd83JSyt6EbGJpOhrJcW7PhYopcN2d CQmOQTjPM0XkbkqpTl/dDmHXLMebupxjJ2G5u3gr3RvZpR41wV+fhnAhVs718IXmT8MxWD0zgE3T5 6xCzMrbHGmCA1+GhDohA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1iM9M7-0004t5-I0; Sun, 20 Oct 2019 11:26:39 +0000 Received: from mail-pf1-x444.google.com ([2607:f8b0:4864:20::444]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1iM9M5-0004sa-7c for openwrt-devel@lists.openwrt.org; Sun, 20 Oct 2019 11:26:38 +0000 Received: by mail-pf1-x444.google.com with SMTP id v4so6541998pff.6 for ; Sun, 20 Oct 2019 04:26:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=yIfx7x5q6VfO1k3FG+/WbYdOYm+zMB3yC9Sw9uNW/Ic=; b=Of4C3G1jWiu5rSk8KkjAudnFpKS3OBqdwix4u4cDnxlIMjriElOjKhb/LAcfeOzSEn BcNwi2lGyDxQPmnEVA6UkUh32A+sqHfamJ6pMumNIO42vlzDOqu4bhrhlP96vavFpIOi D8f14m8X0DfqAgdN1tyT7kwFbPSXZLQKmQmwi7eaiZgiOryv7s9fk8/elEvmUP79yH0s O4E1Wy/1rNw+NxOrMs4+XycybG0bz7xY4aNjpv0KesJrztsVcOEjHx3rY2pssevns/VD xsnctaGCo4AMYYejnwJOxBzYouRa5rqYq/FtwCy/EUygA4ELsdQc07r2MrZBpRy4D2o+ GTdA== 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:mime-version :content-transfer-encoding; bh=yIfx7x5q6VfO1k3FG+/WbYdOYm+zMB3yC9Sw9uNW/Ic=; b=a1qFFDyyScz0G7EQ1LMI1kG5CoBYiHOkbb6ZbEBMPA6i6QEKE/kVYBORwrQLwkCawh X0Kb6cDKIa8lNTZ1R53blDfwPoqq3fsuL9KnsBZC9C4UoWjNHCUUgrTZKYaAGpT5XsJH wk2Pg1PIZCYwNf16UliBEfhvoy+yZW6GPW6FyPI5+Lg1b9pffyfYSSz9NUhNHJFHrl/f vUlRXaUFHVbDR3ROrXAbarFykN3VnmMwrV5GzbBBC3ktZKQIrUg6MZ6JLbFqtA2b0MjZ NxML5PWnaOXxoEuxEndu/tTr8JmSisDUoiLaEuIooIaJPJE0KqaIV575EdxRV1L4h6SG Idlw== X-Gm-Message-State: APjAAAUpn2Uw6HMewLWEKr2HELUhb6HKsoJCBInK4v/Po6ZapwlOYrg5 Pb18VheZWFyyTtBrGHWxOnM= X-Google-Smtp-Source: APXvYqzyJ63Kb21uqhDblhn30OHk3uUPr2YaIdNYSNJDoNtaLTFRtkUbpnS4Sjk7iFstCrE9auxtgw== X-Received: by 2002:a63:8b:: with SMTP id 133mr2641426pga.183.1571570795939; Sun, 20 Oct 2019 04:26:35 -0700 (PDT) Received: from titan.hq.cloud.yunionyun.com ([47.244.19.249]) by smtp.gmail.com with ESMTPSA id q42sm13008983pja.16.2019.10.20.04.26.33 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 20 Oct 2019 04:26:34 -0700 (PDT) From: Yousong Zhou To: jo@mein.io Date: Sun, 20 Oct 2019 11:26:05 +0000 Message-Id: <20191020112608.129703-1-yszhou4tech@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20191020_042637_295719_BB5CD4E8 X-CRM114-Status: UNSURE ( 7.78 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.2 on bombadil.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (yszhou4tech[at]gmail.com) -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2607:f8b0:4864:20:0:0:0:444 listed in] [list.dnswl.org] Subject: [OpenWrt-Devel] [PATCH rpcd 1/4] plugin: exec: properly free memory on parse error X-BeenThere: openwrt-devel@lists.openwrt.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Yousong Zhou , openwrt-devel@lists.openwrt.org Sender: "openwrt-devel" Errors-To: openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org Signed-off-by: Yousong Zhou --- plugin.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/plugin.c b/plugin.c index 3740622..d3526aa 100644 --- a/plugin.c +++ b/plugin.c @@ -321,11 +321,16 @@ rpc_plugin_parse_exec(const char *name, int fd) obj_type = calloc(1, sizeof(*obj_type)); - if (!obj_type) + if (!obj_type) { + free(obj); return NULL; + } - if (asprintf((char **)&obj_type->name, "luci-rpc-plugin-%s", name) < 0) + if (asprintf((char **)&obj_type->name, "luci-rpc-plugin-%s", name) < 0) { + free(obj); + free(obj_type); return NULL; + } obj_type->methods = methods; obj_type->n_methods = n_method; From patchwork Sun Oct 20 11:26:06 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yousong Zhou X-Patchwork-Id: 1179991 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.openwrt.org (client-ip=2607:7c80:54:e::133; helo=bombadil.infradead.org; envelope-from=openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="aREtR0o0"; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="TAj2NMR9"; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 46wyCf06ydz9sCJ for ; Sun, 20 Oct 2019 22:26:54 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Subject:MIME-Version:References: In-Reply-To:Message-Id:Date:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=abZa8+XJUfQnUeMNtMZUnK9Ey5TdVWbvObp/ciU03EY=; b=aREtR0o0V3/ASo 9MFWbEXjQOt/DA9lVuLUXHMW5dip+Es2TSIvSxO+xO1Hyci6KAY+9a4PsBb+5jDI66y5X31ciVWsv tGBUyPr77YCmIqmtBEzNJ0cCQgWIVWlG2JB6wv+OfZ6RznmmEfLaQBkyKShYLt4hLqyZu2IWdRou9 1d8Jd9jATe0nS5TsbGwydi2tWB+82GTh1H4zinF3yNe8/72YekAzFTiXoACDuxqY2tVFOO4MgydWR Sm5htCYGPYHw06jK32+1DHbpwuDjE0emPq8/WEYvZRJtWIS382cGTUVbaMRLWDurwbhIYLZ07sFb/ 6GAWVYIqeFvWgPTsRYbw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1iM9MH-00056C-9m; Sun, 20 Oct 2019 11:26:49 +0000 Received: from mail-pg1-x544.google.com ([2607:f8b0:4864:20::544]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1iM9M6-0004sm-S6 for openwrt-devel@lists.openwrt.org; Sun, 20 Oct 2019 11:26:40 +0000 Received: by mail-pg1-x544.google.com with SMTP id e15so5882846pgu.13 for ; Sun, 20 Oct 2019 04:26:38 -0700 (PDT) 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 :mime-version:content-transfer-encoding; bh=dewVCS/7JBbxKksE2Vov+3TUCQAWtJOnNFVCaWe2Me0=; b=TAj2NMR9WoQCZqeQdDwDi3ZAkmKZSVuE+i6kKLm0MmVEW6WP4zi6WZe+/yCQOsCM5T QO7p2W00FJhIDAUssBS+TnbzyXIV3g5JY0PxGk9mqrWx7p39D/RBml7QahM+GkeMA7Zg YEtDMlt13FvKkj640kNuLlePR1Zswy3fHHFsHHmctkiPRl9O1tX6nL33MCv3PSz8Bnry sqc5gOSDBxws/Kn2q7pff59EudB7J0kYmHo26jT1DHqseYrRPvKxOY+lwDgyVN5yxipw l/dc0qngzUZlCyY/y5gYW8Z5AadmmxzcjqFgabNywLanOXfn2TRBJCUs1o55gh/5y/vB A9Mg== 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:mime-version:content-transfer-encoding; bh=dewVCS/7JBbxKksE2Vov+3TUCQAWtJOnNFVCaWe2Me0=; b=qJtJsySYmh3joKMKAiavuEerN0aByiw8YN9Oz3vIgbLG8giBzZb9B9C7BFYAMc5DXQ tggLlrmBmsnb0WnDcd1XzNXBpZ4CfXmfviMUcLiBUd/XRhtIkrkHKQ7a2SDTI0aTnY6N QHd6bKm1JQWVlDOoFhkpTlUnwafEeSnbIGMLcbkDHj5D1aA5mjkD87xQ4KyQLTQde6Cq 9RH2ZSHXHxxNuB/Ml+w09xc1hNoeusxDhrpDn1P058akcsCgcEhqMEJljxOq1O1E1vca HmL/tgqHX4f6IGsbHmgYs0wKB1uBdAcOC5N3vk33xKEPQ+2OVP+ve5zkWMFAhu/U8u7f jWsA== X-Gm-Message-State: APjAAAUbDJUB3Cni1SudZP5d+gCUd8w8u3UCR6e3G9N5+PfifLRWiApk 8twE3HzhnzuRaSbl1ExG1DggoQ8Na4o= X-Google-Smtp-Source: APXvYqxTwdtuEFvIBcmxDboHa9FKV7eh1fkEPp9Wn9LPJqVbegIsV8idBWPas7u2atuxPAFrOA0RJA== X-Received: by 2002:a63:1e1f:: with SMTP id e31mr6310773pge.303.1571570798137; Sun, 20 Oct 2019 04:26:38 -0700 (PDT) Received: from titan.hq.cloud.yunionyun.com ([47.244.19.249]) by smtp.gmail.com with ESMTPSA id q42sm13008983pja.16.2019.10.20.04.26.36 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 20 Oct 2019 04:26:37 -0700 (PDT) From: Yousong Zhou To: jo@mein.io Date: Sun, 20 Oct 2019 11:26:06 +0000 Message-Id: <20191020112608.129703-2-yszhou4tech@gmail.com> In-Reply-To: <20191020112608.129703-1-yszhou4tech@gmail.com> References: <20191020112608.129703-1-yszhou4tech@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20191020_042638_902583_E95B2B03 X-CRM114-Status: UNSURE ( 9.34 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.2 on bombadil.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2607:f8b0:4864:20:0:0:0:544 listed in] [list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (yszhou4tech[at]gmail.com) -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain Subject: [OpenWrt-Devel] [PATCH rpcd 2/4] exec: properly free memory on rpc_exec() error X-BeenThere: openwrt-devel@lists.openwrt.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Yousong Zhou , openwrt-devel@lists.openwrt.org Sender: "openwrt-devel" Errors-To: openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org Signed-off-by: Yousong Zhou --- exec.c | 7 ++++++- plugin.c | 4 +++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/exec.c b/exec.c index eb52966..f490ad7 100644 --- a/exec.c +++ b/exec.c @@ -313,7 +313,7 @@ rpc_exec(const char **args, rpc_exec_write_cb_t in, switch ((pid = fork())) { case -1: - return rpc_errno_status(); + goto fail_fork; case 0: uloop_done(); @@ -372,6 +372,10 @@ rpc_exec(const char **args, rpc_exec_write_cb_t in, return UBUS_STATUS_OK; +fail_fork: + close(epipe[0]); + close(epipe[1]); + fail_epipe: close(opipe[0]); close(opipe[1]); @@ -381,5 +385,6 @@ fail_opipe: close(ipipe[1]); fail_ipipe: + free(c); return rpc_errno_status(); } diff --git a/plugin.c b/plugin.c index d3526aa..ac8de6d 100644 --- a/plugin.c +++ b/plugin.c @@ -161,9 +161,11 @@ rpc_plugin_call(struct ubus_context *ctx, struct ubus_object *obj, c->argv[1] = "call"; c->argv[2] = c->method; - return rpc_exec(c->argv, rpc_plugin_call_stdin_cb, + rv = rpc_exec(c->argv, rpc_plugin_call_stdin_cb, rpc_plugin_call_stdout_cb, rpc_plugin_call_stderr_cb, rpc_plugin_call_finish_cb, c, ctx, req); + if (rv == UBUS_STATUS_OK) + return rv; fail: if (c) From patchwork Sun Oct 20 11:26:07 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yousong Zhou X-Patchwork-Id: 1179992 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.openwrt.org (client-ip=2607:7c80:54:e::133; helo=bombadil.infradead.org; envelope-from=openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="HL1BQqoV"; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="Yd2eiZuL"; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 46wyCv0kg2z9sCJ for ; Sun, 20 Oct 2019 22:27:07 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Subject:MIME-Version:References: In-Reply-To:Message-Id:Date:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=Ql7T8TC11dPkjTDSgd+7wkdDfF9DEB6Asr1M6qbtxv0=; b=HL1BQqoVvEH4Ih eGipcBY91rmWnm07aK9pLbItclsbjdlXoT7Gzpe+V5RMmBVBkR0MeT+b8NE+SyOsar7SKfLshR40S cxRAJdAkKKvV2bpFY02CgphT9whtzV8+6gAxw3OKPxN9n/fssn5E1sgm34y1Zp+6cCsfw5F6nv3tV UqFTMeqf57wGs4/VQdZaP3e3W9ETl1ftJ3jUvDEmrJz0vxRuSCdFQflNuLt0ro7lEMIwLX6vebWcm sWKrGs2SpvtwTKRfqZoMPPUeiYZMSEOACCIE9dlO0IRJX7KKOFQ8KvjcL2iY5KAXSIl6dUUFOZo23 lT7YHZ0nKRzdhQZs4dVQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1iM9MU-0005N4-Ub; Sun, 20 Oct 2019 11:27:02 +0000 Received: from mail-pg1-x541.google.com ([2607:f8b0:4864:20::541]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1iM9M9-0004uj-7e for openwrt-devel@lists.openwrt.org; Sun, 20 Oct 2019 11:26:42 +0000 Received: by mail-pg1-x541.google.com with SMTP id k20so5919851pgi.1 for ; Sun, 20 Oct 2019 04:26:40 -0700 (PDT) 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 :mime-version:content-transfer-encoding; bh=ejY+PPDeC6zoFnTQsHsb6CWTJLNp3GAskceRPkj6Yh4=; b=Yd2eiZuLEM8Q2DK+Qlb1Tt5zGHKUkwc6ItiqLAjS1EfmXwTzD0qd5iqWzyE9w5hXzW 3vcYhxT/oJTTAsrTHpGTqK6IEaKs+syKdywsgDCfqZh22ubvDQa32Iwox62SMW6G2PO6 yA+CWBLVzjLZN4RMWOX6useBaEmN1MbI/mbJh7NHAQtrWG25AClcPCzrxAOUoGimFDBn 9W6m4wlJ3A1azv69YKVMnKdWD0QBw2QGGTtLkagukutwkRwUueoFxqPsS3udJU2WeqIx akD8iZGMZYEJ0zDLjeFESrs+wbGlN1lrvCfGktJGcME21kdysgu9yogh8sPsCetcov/n RtQg== 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:mime-version:content-transfer-encoding; bh=ejY+PPDeC6zoFnTQsHsb6CWTJLNp3GAskceRPkj6Yh4=; b=Ixv5kOYRzSogvdzV2ioR1TavzqFds+0QozDIzBN9SjGnviThIF1cBdeq6sc3qBxlC4 hpAIB38h3I9uf/Uj0piSinMD2sPwNyWyxmF+g5sQNTBHNYJ4DTN+2Po56YvuyAEl3cZX 90Xw2tNs0oH16Dr2zVvb+MyotCkm548Wd+4m9YyHhhXdoLgtbncHmWp4l6YfJxqZr6HW ng6B6AggLgSzhFg3gTzmSpOUT/d0Xg5S6bQAkI5vRmjgwhXi9CebGqJmiuV2fKaNTej7 iIS6lGsTz1JV9uR6RIbrxw1JZIT1qnwIaPuxdy1pYBq/s9BKDiFbhOWDRYE8QXYuYM68 9Lnw== X-Gm-Message-State: APjAAAVxGSmq9Q46LjNcwWFJSlQ7E/J4OECAoUVX+8BqAH9vK5mhYOg9 DRM56UT6R9xAX3hseEmlkXg= X-Google-Smtp-Source: APXvYqwcbB5+rcv7yukWQRW2u3UYwT5Dh2acXuHtoEvGr7+6bxxGZH13HnD8Jhkxp6VgAkUBSN+Mow== X-Received: by 2002:a63:3c3:: with SMTP id 186mr6471525pgd.285.1571570800281; Sun, 20 Oct 2019 04:26:40 -0700 (PDT) Received: from titan.hq.cloud.yunionyun.com ([47.244.19.249]) by smtp.gmail.com with ESMTPSA id q42sm13008983pja.16.2019.10.20.04.26.38 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 20 Oct 2019 04:26:39 -0700 (PDT) From: Yousong Zhou To: jo@mein.io Date: Sun, 20 Oct 2019 11:26:07 +0000 Message-Id: <20191020112608.129703-3-yszhou4tech@gmail.com> In-Reply-To: <20191020112608.129703-1-yszhou4tech@gmail.com> References: <20191020112608.129703-1-yszhou4tech@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20191020_042641_293172_27A62132 X-CRM114-Status: UNSURE ( 8.61 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.2 on bombadil.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2607:f8b0:4864:20:0:0:0:541 listed in] [list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (yszhou4tech[at]gmail.com) -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain Subject: [OpenWrt-Devel] [PATCH rpcd 3/4] exec: alway call finish_cb to allow plugin to free up memory X-BeenThere: openwrt-devel@lists.openwrt.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Yousong Zhou , openwrt-devel@lists.openwrt.org Sender: "openwrt-devel" Errors-To: openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org Signed-off-by: Yousong Zhou --- exec.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/exec.c b/exec.c index f490ad7..1b05a91 100644 --- a/exec.c +++ b/exec.c @@ -131,13 +131,12 @@ rpc_exec_reply(struct rpc_exec_context *c, int rv) rpc_ustream_to_blobmsg(&c->blob, &c->opipe.stream, "stdout"); rpc_ustream_to_blobmsg(&c->blob, &c->epipe.stream, "stderr"); } - - if (c->finish_cb) - rv = c->finish_cb(&c->blob, c->stat, c->priv); - - if (rv == UBUS_STATUS_OK) - ubus_send_reply(c->context, &c->request, c->blob.head); } + if (c->finish_cb) + rv = c->finish_cb(&c->blob, c->stat, c->priv); + + if (rv == UBUS_STATUS_OK) + ubus_send_reply(c->context, &c->request, c->blob.head); ubus_complete_deferred_request(c->context, &c->request, rv); From patchwork Sun Oct 20 11:26:08 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yousong Zhou X-Patchwork-Id: 1179994 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.openwrt.org (client-ip=2607:7c80:54:e::133; helo=bombadil.infradead.org; envelope-from=openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="W//rShwM"; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="k+1/JZvO"; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 46wyD51p90z9sPK for ; Sun, 20 Oct 2019 22:27:17 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Subject:MIME-Version:References: In-Reply-To:Message-Id:Date:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=dBG0RxFr5kdsaYc5CVQCP92HMIkrkpVOs7BhNNolpew=; b=W//rShwMxk80F7 kHZGpOhBVxR4p4tsARWLwbmW6HgqUVJ8FSuyOQNNYoZaicS/P7advmwmAG6LmaBcnd4Pt0G+Yth1g UhBR5I+6km7kFj/e0JCEemnjLE2CmhV9qeB6gIdWkYB9dQX73LSR9eoFFXtR5y18jQgvecBedtp+S TUMFnYTuSX6kBBuX3vaZFsXcq2IIazux2gDHNcjSRGu51l2T95tEdmak6noqgI9l9iQHq5FVtwiIT i2ZGPHt5oESfEHU67hZEg3h/0+7o9hYcVlFUOHsfomR+ZQ9/sQlUf9WLNSatS9uXAX3WuG/T9pCBd 6Ar90z3QfNUXLZui/OKA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1iM9Me-0005YY-QD; Sun, 20 Oct 2019 11:27:12 +0000 Received: from mail-pg1-x544.google.com ([2607:f8b0:4864:20::544]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1iM9MB-0004xx-B9 for openwrt-devel@lists.openwrt.org; Sun, 20 Oct 2019 11:26:44 +0000 Received: by mail-pg1-x544.google.com with SMTP id f14so5890837pgi.9 for ; Sun, 20 Oct 2019 04:26:43 -0700 (PDT) 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 :mime-version:content-transfer-encoding; bh=Y+cd/mTDc3lc5WzC6mmSoTRtAxA7VUtk54DyNACU7r4=; b=k+1/JZvOgPs5R005e86OaMmf30BwF5Es0bnZiV+WhkSAFuZX6bv6vgXlcmnHYidC0m Yggkto0Bxx7n96t1/aBNXMLT5TJ+PPbNoRnmFeif6qTzjF6pgoxauK2/6HY0n8XHFXbY IcPxh3EE2t/Nb6Q8w9OizzyygLRijxuiLk+jIsW8Ulz3uLcMmAdJwnQLPUnlMQ3fbmal iU051u0lq5kx4d970iV+ssHU5pzndhiQubByP2wCoTLvTK4X5S6aspznfKLZS2uI0aQq NJ5QPYihj7F9xGfBKKxHsRIemtMsGxS7bsS1nLI1dM+brD/ztRJp+8u3eRjsIlUzhoGC KpQg== 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:mime-version:content-transfer-encoding; bh=Y+cd/mTDc3lc5WzC6mmSoTRtAxA7VUtk54DyNACU7r4=; b=nbI6QBEFJ6IGFKnq2U1bIYLHFHDHFwAnB7apbcJgrI0RFbgVLrIxz2sWTkLcQlsqLZ 5X2eJsf8rVtHc+io3gOFfRwdu7CTZt2huvPFmF/P4sF2GNLgzEIHAjXS3qtJFGpee8a+ hIG7sjTzGXt6XJ9x+U2WXmnQu5Nl7dE50sPQdaS2K4sYFHejWvLBLPkjuoyUzfn2gVuU Yx7nowW24Vb0TObmE7YWfHnOgzRmtwbppfOLY4BYFuitAQg0sTMX9yENb8dylGxP0x+I sjtaxAMoHObD/OdkHFOLNhYB5IRHV9m0YvbDB5Mg5NigVWT+a6fIc/Ijoxx8fO3/acca rfzg== X-Gm-Message-State: APjAAAWq8q4bjA44GzbuxwWS9PpnWGyK5JytFEMMWM79ikrmwCHSNii+ Y7NrrLV+hWuui/FXcXeJoHo= X-Google-Smtp-Source: APXvYqytniWS81KUC8FUNOGYP00MZZwDl8qHXUY44uqwQQ0QAsKlrod4ZQ/T9o7I4m5EoVHq98my3Q== X-Received: by 2002:a63:710:: with SMTP id 16mr20233360pgh.329.1571570802597; Sun, 20 Oct 2019 04:26:42 -0700 (PDT) Received: from titan.hq.cloud.yunionyun.com ([47.244.19.249]) by smtp.gmail.com with ESMTPSA id q42sm13008983pja.16.2019.10.20.04.26.40 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 20 Oct 2019 04:26:41 -0700 (PDT) From: Yousong Zhou To: jo@mein.io Date: Sun, 20 Oct 2019 11:26:08 +0000 Message-Id: <20191020112608.129703-4-yszhou4tech@gmail.com> In-Reply-To: <20191020112608.129703-1-yszhou4tech@gmail.com> References: <20191020112608.129703-1-yszhou4tech@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20191020_042643_453316_5D4B60D5 X-CRM114-Status: UNSURE ( 7.63 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.2 on bombadil.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2607:f8b0:4864:20:0:0:0:544 listed in] [list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (yszhou4tech[at]gmail.com) -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain Subject: [OpenWrt-Devel] [PATCH rpcd 4/4] uci: free configs list memory on return X-BeenThere: openwrt-devel@lists.openwrt.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Yousong Zhou , openwrt-devel@lists.openwrt.org Sender: "openwrt-devel" Errors-To: openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org Signed-off-by: Yousong Zhou --- uci.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/uci.c b/uci.c index 1587a19..7667505 100644 --- a/uci.c +++ b/uci.c @@ -1284,6 +1284,7 @@ rpc_uci_changes(struct ubus_context *ctx, struct ubus_object *obj, uci_unload(cursor, p); } + free(configs); blobmsg_close_table(&buf, c); @@ -1388,6 +1389,7 @@ rpc_uci_configs(struct ubus_context *ctx, struct ubus_object *obj, for (i = 0; configs[i]; i++) blobmsg_add_string(&buf, NULL, configs[i]); + free(configs); blobmsg_close_array(&buf, c);