From patchwork Mon Oct 7 19:30:22 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 833409 Received: from mail-wm1-f45.google.com (mail-wm1-f45.google.com [209.85.128.45]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A22B71D935D for ; Mon, 7 Oct 2024 19:30:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.45 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728329438; cv=none; b=ELD8l+sLvaeQqevF6fnRdGA8xQUI1aDO8xk1hVNVNlYssH0wkkM+tdoiKUcflNuVHUSX+/9iembzPAvgUR6APKOKPwaKsKZkcmrI+0CMeSaxfAG3bC5E4mGChBO6mKmso0ZKStCnYP7laYUUDsHZFU4Jvw9rBwnEp4IQkAoYK/k= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728329438; c=relaxed/simple; bh=zgmVYRzyWM/SdztsAByJnMxMP1zjIU7ySm+mi9M4YQk=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=DLdM+EytsKjDbatiMqJVNr61grQ+2C7tqkFEGbyzjDYnPFf91M0Otyerv385A6mTNbqnv2TvkMSO0g9IbY0zwWd+OhgOcsPEC1PrAf6lkCO6xgE3ezYbm6EbnkmNNQPu9m/5O7y5iwJYiUYortFPG6xcUfiGpYumejsvcXrez3U= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=bgdev.pl; spf=none smtp.mailfrom=bgdev.pl; dkim=pass (2048-bit key) header.d=bgdev-pl.20230601.gappssmtp.com header.i=@bgdev-pl.20230601.gappssmtp.com header.b=T22Edcls; arc=none smtp.client-ip=209.85.128.45 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=bgdev.pl Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=bgdev.pl Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bgdev-pl.20230601.gappssmtp.com header.i=@bgdev-pl.20230601.gappssmtp.com header.b="T22Edcls" Received: by mail-wm1-f45.google.com with SMTP id 5b1f17b1804b1-42e5e758093so42120175e9.1 for ; Mon, 07 Oct 2024 12:30:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20230601.gappssmtp.com; s=20230601; t=1728329434; x=1728934234; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=4Hilv4Ii4eTmBA7qb5KQRRNfefq6cWF0PKDiqvEJnT4=; b=T22Edcls+dD6izMWRIzJz9usaZ2ITwv9qSyPGndn9/IjeZLzT8lO132ffVgrI09mT0 riwcMaEGmGd/cw/MvupZyId2CZo2Jt/WAIVJPM26dfBqzRjiIflWn0WkiM5lq1fccX30 4TmezkbyWc6Ym/T4fbO3e1Gqis3ZV6Y+7h8IaEhRSCk+p5RuynTuUllaftBE7E46COwk BhE+lMZ67HcDkohBs3cay/EXaqiysyBCsC3XdIC/mRjwga9I7Pp0x3ko7Gxkvz4Pv8ap 8EIMrsQi3T/LwSGCeV900+8p4Htc5HYlydpdaHq5xC77RWmBt2cmcY3rBnbcT/56XsKC tTJA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728329434; x=1728934234; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=4Hilv4Ii4eTmBA7qb5KQRRNfefq6cWF0PKDiqvEJnT4=; b=S+XXMrw1kurw08HkntFSO/YLVbat31kCRInT2r97LDsMI53Rtq9nrncjZ2rlDfELRy InBDRbsTHZhIdSvI9oqwDWHbdz7nhl3ogbFAxEUhHPwVetAKDmatuXZVpXbjNzzGcDiB QvJUJrCu2k4BIYZ3yp2Q1XKlERa4KBJRv1R53iumUhwg6SuvR3s5kYqivV/IxNVySRQ0 Swq4YfxtBjeI0zSCIjiMq/nmdPg6eTVXSKrND65X4fQXgITOS+drTF+Kjt140lJsnrF1 Xnx3XxN9/Ml+lx/mTf9OvorZD4sZRIdYO7sHtLYs280/PaTwMfJ351IhPxlOgjQwlL3u SnWQ== X-Forwarded-Encrypted: i=1; AJvYcCUVAVq6LBRR0D/RsnPaqgR2SlGTqsChITHXcjl9VLuMHY7U8gDlA0vfc4nzLwhhj8Smy0Kha1dOxlAT@vger.kernel.org X-Gm-Message-State: AOJu0YxNz0UH+PK99V6JSxL9EeveTXm7+IZM9VGawELtnmsUgerMLvWb XZFWv4Yfdq1hzvKKw8fU3bQIWa2bApn9X+bom9gWduHKjOZPK11Emp80g/p2IIo= X-Google-Smtp-Source: AGHT+IFYcwzeeCaEunm82a1aKvqD6FdMYaRMTLfIAmS9pqGZTyXBKciqoH7ZNw9UzgtLbg0JKCGq7w== X-Received: by 2002:a05:600c:1ca5:b0:42c:cd88:d0f7 with SMTP id 5b1f17b1804b1-42f85ab4830mr94103485e9.10.1728329433790; Mon, 07 Oct 2024 12:30:33 -0700 (PDT) Received: from [127.0.1.1] ([2a01:cb1d:dc:7e00:6100:637:cbe9:f3bc]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-42f86a2052asm101321905e9.18.2024.10.07.12.30.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Oct 2024 12:30:33 -0700 (PDT) From: Bartosz Golaszewski Date: Mon, 07 Oct 2024 21:30:22 +0200 Subject: [PATCH libgpiod 1/3] dbus: client: notify: fix reference counting Precedence: bulk X-Mailing-List: linux-gpio@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20241007-dbus-memory-fixes-v1-1-0d56d1aa032d@linaro.org> References: <20241007-dbus-memory-fixes-v1-0-0d56d1aa032d@linaro.org> In-Reply-To: <20241007-dbus-memory-fixes-v1-0-0d56d1aa032d@linaro.org> To: Kent Gibson , Linus Walleij Cc: Bartosz Golaszewski , linux-gpio@vger.kernel.org X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1051; i=bartosz.golaszewski@linaro.org; h=from:subject:message-id; bh=MYhIU0N3++ROKfLK9GhlVxMWZ/O3JQbWQNoOx+sSke4=; b=owEBbQKS/ZANAwAKARGnLqAUcddyAcsmYgBnBDbXTAbFT5UXBHXOk+d3apZynny/ky5Cn3w5X 76mdrnKI/eJAjMEAAEKAB0WIQQWnetsC8PEYBPSx58Rpy6gFHHXcgUCZwQ21wAKCRARpy6gFHHX coKgEACUoN8Eusk+LUzHNyKltNgQhvEl4Z1ax73RSVuiyMgvuo25i0mAGUnjo9+1dr2LooZQleK ayrq2JMV8tRSnEhVpQrUg2LgAk3LwnmrupK6gKnzKhq7YYdswVupoGjJslxK5faPm0xpOFVynxV 5rO/4CSwH6jH4FEHU8h09R/3PAoFuKPTzjCNxD7bdKi0a+Ux0ikZUR4Pwrn+oNphGkm5gCm7FQq lG8cSLGBh34Bb4U6lPFKLcGw1CpeyhjiuVsTk/nYUhSpoebw4/jl63f5G98GXbuJbytERO1gTcL p0gk/rVI0S7aVOnnurokES2rgU+ppiBDf7PMToq/2Ba417EY3HBRx4mflUm28ACrOXistsV497y 2CLLDzGaK3pkHiPs+3aId4HeQqM+Fd2Y8ai/sqC3ZiQJv0t2/lMj6QcFHJuydUw3vHAYevZZA0U 84XJ9hDHSgXIH/lwlJ0vb9OUMjdnF1dNjmnJ3l5Vb5NLJO3aHEgXO/MlqDHJXrTBlTS4+tfcaVK Sg6Ph291klGVG3ozTUtgGdNUKuLyB+DQw7zzehLrPLR15vqbzpe44A3Yq4pTMwFd3b2ksFSyB4r x50stv3PyhqsOHu1cYbXpulgsxERmD1n1NS4hCSNOHKE1pwdOAhFfSimbiNy0xl9mZ/wBY8R9DP 31M+XJxTOa5Y5qg== X-Developer-Key: i=bartosz.golaszewski@linaro.org; a=openpgp; fpr=169DEB6C0BC3C46013D2C79F11A72EA01471D772 From: Bartosz Golaszewski There's a reference overflow when adding chips to the global list and an underflow when fetching existing chips from that list in connect_line(). Fix both issues. Fixes: a5ab76da1e0a ("dbus: add the D-Bus daemon, command-line client and tests") Signed-off-by: Bartosz Golaszewski --- dbus/client/notify.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dbus/client/notify.c b/dbus/client/notify.c index 5c73343..6d51a6f 100644 --- a/dbus/client/notify.c +++ b/dbus/client/notify.c @@ -211,10 +211,10 @@ static void connect_line(gpointer elem, gpointer user_data) if (data->scoped_chip) { if (g_list_length(data->chips) == 0) { chip = gpiodbus_object_get_chip(chip_obj); - data->chips = g_list_append(data->chips, - g_object_ref(chip)); + data->chips = g_list_append(data->chips, chip); } else { chip = g_list_first(data->chips)->data; + g_object_ref(chip); } } else { chip = gpiodbus_object_get_chip(chip_obj); From patchwork Mon Oct 7 19:30:23 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 833695 Received: from mail-wm1-f54.google.com (mail-wm1-f54.google.com [209.85.128.54]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 34F981DE3B7 for ; Mon, 7 Oct 2024 19:30:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.54 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728329438; cv=none; b=c6BloTMvy1naLHfpsEAzxFa3tsCfqkIQ1Y+pUdGYUp2PoKuDjgjqCSgOXwX9kPd7FLXNBCbOKDDg9vR1KF/C4B8KBTLV5vRBv/tOFErFhRXihTD8DzoOU5P7WGzs5RverZJl0HnIb4rggGZSCiPSjQvPNOszwmYrw/6icaFa92A= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728329438; c=relaxed/simple; bh=63sLWxcYmXRF+WAepF+x36n+IhH+6N4LlffRri+/Pcc=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=oXsOWsLOdZXEAFTOT8PW+H20RkbXrB9IS7iC8tObaWXRIsOAmgQLtFaby3SgzWAszaFSwxB5wfXnkLO2XVDKVpzuEFRrHShcRNVDhfdLpdEZWOGoSngGBBLRk/5PCVIHTqSRtRDlPXufFzJp5DHyq51aqv7+D/31OM5Unl6smdc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=bgdev.pl; spf=none smtp.mailfrom=bgdev.pl; dkim=pass (2048-bit key) header.d=bgdev-pl.20230601.gappssmtp.com header.i=@bgdev-pl.20230601.gappssmtp.com header.b=rCMCCDXJ; arc=none smtp.client-ip=209.85.128.54 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=bgdev.pl Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=bgdev.pl Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bgdev-pl.20230601.gappssmtp.com header.i=@bgdev-pl.20230601.gappssmtp.com header.b="rCMCCDXJ" Received: by mail-wm1-f54.google.com with SMTP id 5b1f17b1804b1-42cafda818aso50006165e9.2 for ; Mon, 07 Oct 2024 12:30:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20230601.gappssmtp.com; s=20230601; t=1728329434; x=1728934234; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=25YUxsb9akY7PvWr8m/wSGkMFRJg5/KsPfOZBQb4y7k=; b=rCMCCDXJNdxseBwOjKU2Xro40+F1Yam2sfEFD1P20ZBveRKLyHTg5PvyO1xL+wZcDX AZQsIcuQ+iq7b55IJyTl3ymUDq68ElG2uP/0DML9S11M2gqDp4kVrvHVyjbKebkB8lT/ SClomeBRAuEedeXm6egugBcjt+A+yZ64+T6LT3bazDU9c715+dbZvHzXkR6NUYScvZb3 yAOlHF0/b/WqbtjJj8WVvjHMp/Zo2Rr8BTOUNb685cV0aIJ6jVTdnsl2qQ0+I/pF6LR1 q8SPvCx1xwKnB1bJkBjXAiH3bRVHSvjAtyeUa0fYCqfhZvJW8WXF6dUDR88btsUwn7XY hBUw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728329434; x=1728934234; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=25YUxsb9akY7PvWr8m/wSGkMFRJg5/KsPfOZBQb4y7k=; b=OuEMJt2qoG3xfbysKV4BmjX73nkwgpbtETJW0ttRTi7sLFt5g3Hus7rrdDmqJwlHkv eQkxkRSMtJDDXD2z4RDXF2YoWaYdJaQZwbthkJZnQP3PIIxvaPzyQ7fB1BxI1v1DDi2e mwPBqNMSG3fXiKAPLR+x21NJINX/4WymYUo6kkAj3zO/IknVwsPRvpNj5VjmJ7A6+9h+ OsTmj17bUotoZOTf3890eNS5TsyaGtxEbdnGjtmE/t4IO7Y/cTZ8GKXV5W1Hfw156rmR HtWBy2GdZgaWTULWb4AQu4wIpb6GBg2QAng+jlyR6GeSzX1nZjL2vZID8Qh+bvfpdCXj smJw== X-Forwarded-Encrypted: i=1; AJvYcCUEWs4qif7cHHOdhJyBEVnM45T/42S7JDTDDpPs9i8r+PpBAeMj/z6i6XVt3HL7dS59fJY+XjKFkUcf@vger.kernel.org X-Gm-Message-State: AOJu0YyvdTRcgICqMMw6hEmeYnscucay/wtGnOsPTcSVj1qRuhGwb8p0 jq78/gTp2aVYVBmvcWZEg1azdBvwlUTg+bA1hu2yWxFunbYKobfZRorfwWxGrLQ= X-Google-Smtp-Source: AGHT+IHcJgLYymhs74g21d2IgKl93DtqiklSroOmPHhbArAYvA71H+bdbq4g6x3BkluabgoalNDt6Q== X-Received: by 2002:a05:600c:1d0e:b0:42c:b995:2100 with SMTP id 5b1f17b1804b1-42f85a6d722mr81139395e9.6.1728329434397; Mon, 07 Oct 2024 12:30:34 -0700 (PDT) Received: from [127.0.1.1] ([2a01:cb1d:dc:7e00:6100:637:cbe9:f3bc]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-42f86a2052asm101321905e9.18.2024.10.07.12.30.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Oct 2024 12:30:34 -0700 (PDT) From: Bartosz Golaszewski Date: Mon, 07 Oct 2024 21:30:23 +0200 Subject: [PATCH libgpiod 2/3] dbus: client: notify: free chip and line lists at exit Precedence: bulk X-Mailing-List: linux-gpio@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20241007-dbus-memory-fixes-v1-2-0d56d1aa032d@linaro.org> References: <20241007-dbus-memory-fixes-v1-0-0d56d1aa032d@linaro.org> In-Reply-To: <20241007-dbus-memory-fixes-v1-0-0d56d1aa032d@linaro.org> To: Kent Gibson , Linus Walleij Cc: Bartosz Golaszewski , linux-gpio@vger.kernel.org X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=824; i=bartosz.golaszewski@linaro.org; h=from:subject:message-id; bh=MJ2k/ebiUib5arRMg4oghZtEGHdH87fRjj6Uq1GmkYk=; b=owEBbQKS/ZANAwAKARGnLqAUcddyAcsmYgBnBDbXjioMxudb9CuUsPS2LtzIsbYFDueZNHWfH WUysYAWSgaJAjMEAAEKAB0WIQQWnetsC8PEYBPSx58Rpy6gFHHXcgUCZwQ21wAKCRARpy6gFHHX cn3UEACnQl2Xp5Y1GVllV1lqwq+yYDMUbK/oHOOU40cSWQtL95mpY+uzLUlJm7gDU2c3sUEy2S2 Q1wc0KDL6CwSk4vz2rxgG1t8A0/d5TqAtGzsAbIo5/CEFfyDuAVzXtIecbPL9DUQ57f5OmdEfir 3MQzcAqoEalkDP+STpUfVXZ5iLnjjfh3Vh4oVbauVUNXo1LKdPuDtpCqbtGQ0z+cEU2RibO+IXE lqwQriZgKV4QzAkg2IGQ7UL0Vh/cnOQMFN0JMbXtJ1ML9i4jC6m/0TV77KGIHTfPzkpmr25RMjt gNFpqPGuteyZ3CQfjP48/LNKOKixL4f56/U4CJW+Nlyj8lPORAI0OffGAORRiM5p6qhEKFrt/Ks 4tCfbclUBZaBNKZTWNtACiJtqO5PPj/SAbEe/UmHcWfQVTi6G7KtzC6zRMcXJn7PC+ymHdmzpuX 2Lel0O5AQj+GwvdgOIX5eoRS5W1p46loMGqG+g0YjX9T9c0ljd46XyA0wjTSkendGWT5AH9T9vo jB4XgokXrQ6O+JOpaDcbZqHuvxuVgEo+wzNZ9vYfVBAIworYWHJG/jv54aS3rHaCXFX1q2+YBBe Eby2D+fKPn7dUVgY7DsCQznTgdpmO2Dat4XsaANwspBE+WKxr0rScmIOELpAHAtaC1xlfN0dbFe fRlH4PiLQHxUfaQ== X-Developer-Key: i=bartosz.golaszewski@linaro.org; a=openpgp; fpr=169DEB6C0BC3C46013D2C79F11A72EA01471D772 From: Bartosz Golaszewski We don't free the lists storing line and chip objects for the duration of the program when exiting. Fix it. Note: these objects need to be kept alive for D-Bus events to work. Fixes: a5ab76da1e0a ("dbus: add the D-Bus daemon, command-line client and tests") Signed-off-by: Bartosz Golaszewski --- dbus/client/notify.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/dbus/client/notify.c b/dbus/client/notify.c index 6d51a6f..800dd24 100644 --- a/dbus/client/notify.c +++ b/dbus/client/notify.c @@ -289,6 +289,8 @@ int gpiocli_notify_main(int argc, char **argv) g_main_loop_run(loop); + g_list_free_full(data.lines, g_object_unref); + g_list_free_full(data.chips, g_object_unref); g_bus_unwatch_name(watch_id); return EXIT_SUCCESS; From patchwork Mon Oct 7 19:30:24 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 833408 Received: from mail-wm1-f43.google.com (mail-wm1-f43.google.com [209.85.128.43]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 477261DDC11 for ; Mon, 7 Oct 2024 19:30:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.43 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728329439; cv=none; b=VqXieNK1qp7CN7UhPXVm2E/LcN6GP/NEVMZ45Cull5Yvt9dBIrL0PYT2avxMXj8cTTpoHeseEWCX+rqgpj6RUxFJ369/T4xGHsmd9RkU3yFS/B1CbfIqG2DLPnLKGfZSB9FxOLLUgn6V/qqqXX/NtBHRWcagme3z8Lj/Ti1hPxw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728329439; c=relaxed/simple; bh=4XdL2+WVJ9F//kzcstAYi8IQNZmf0EtVIusvdQHCU7E=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=oDYM0nF7jekFCDRJ3UoqkCcIOPgxO55669mfFXN5LmTMrlxcwGkrfE1qucmepMzXE/LnDrDbEKU6dlp6QsMi0SRdvthf52IJ/iHOr0ee6n2FU1sHiw9z+4dT6iTS45Ff6jEpum+wQMG3gOPxc62iGKy4Xwe4S8kJxhkOZutlv2M= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=bgdev.pl; spf=none smtp.mailfrom=bgdev.pl; dkim=pass (2048-bit key) header.d=bgdev-pl.20230601.gappssmtp.com header.i=@bgdev-pl.20230601.gappssmtp.com header.b=esqatJWX; arc=none smtp.client-ip=209.85.128.43 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=bgdev.pl Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=bgdev.pl Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bgdev-pl.20230601.gappssmtp.com header.i=@bgdev-pl.20230601.gappssmtp.com header.b="esqatJWX" Received: by mail-wm1-f43.google.com with SMTP id 5b1f17b1804b1-42cafda818aso50006275e9.2 for ; Mon, 07 Oct 2024 12:30:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20230601.gappssmtp.com; s=20230601; t=1728329435; x=1728934235; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=tmqgmJUlFcbESupMAYcxNlYTm/h2fMG4CUA0gL+IzfU=; b=esqatJWXpD69PSvgYpbqZo4NLPBQrLaQW5ta1rH5K6hOQjtpxlNVFsR2Y1zJpTMlFU yCwfEVk2EPBsohbs/n+e4wjkDKMC5FP7fhr1RvbGtg0ZIqSN193sKbSHO3HSsu0tw7Pc 1kubv5xbsoDHnQWdDdWTYhb6YRH1bKRUudeCozbZ2Cap5QrACGzuqNOhMKaURmlSaUMO kt7Um7cHGwVXu365Ni6lhc+mwitFhsqrqR3Znn03LYS4AUNjH2t0P9xKAeG1KIlOuIE8 qjiC3usZPWTGrkARI87tXyFVpJ+7ib+2OHQ3uLRai4iQ+brcED1LI2/upKkQkgybivPk YZvg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728329435; x=1728934235; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=tmqgmJUlFcbESupMAYcxNlYTm/h2fMG4CUA0gL+IzfU=; b=G9lFMYp4Yt1SdInDVF4Kc/sQuQCpaQtkJJxUKENmdXCEEa9Y58OUQrhab4BmuBJozr To1/BoDZ5uv4XEpFPjRrCu5AiVIGcYzz9UgpzobL6MXJAx5ALdyw7EbF8zBSxLyJkacT 5JWSDwYkFUkIuif1zIn94VPPrrnlwCsbZY0lSvp70H8VIt6Tk0Ty5sexo4FUBypq9eQv Z9QwcIGRun3zwznfoQqSj9sE34L0Y7sZYDyfwQaiPuujvg/q5fKYvhRlpdhBZjiNin2U uogm8wlhFspfH1ihm5QAkd/HdAszggQGfCrjEIxRuMtl+x2cZLahq7J1kfXPh+FBPhtR U8Vg== X-Forwarded-Encrypted: i=1; AJvYcCUugQszsNKUV6ACuYTu+5sGswsrgXeBFXHcmPDHNvWVfAuzW/lkhu+bkzk0w2LmMLfMZjMiFXm1KACC@vger.kernel.org X-Gm-Message-State: AOJu0YyaiL3AyhQgmayQ7/50JlfqmHzruMLM0bstOAj4Ma3S4HiqYF35 CbumyBuYSws9Sge4QB524Xgy5nSI7UBebUuqVRTy+Q6oMZXDku5pXx/J5n2qAHQ= X-Google-Smtp-Source: AGHT+IEX2EteKkS75T9Hm1R/cpZx+g0dB2RyTr82qG/CxZM39DrMstdoVWNFJiT0iEReSnGJJjH7fw== X-Received: by 2002:a05:600c:1ca4:b0:42c:b23f:7ba5 with SMTP id 5b1f17b1804b1-42f85aa92edmr104412365e9.10.1728329435576; Mon, 07 Oct 2024 12:30:35 -0700 (PDT) Received: from [127.0.1.1] ([2a01:cb1d:dc:7e00:6100:637:cbe9:f3bc]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-42f86a2052asm101321905e9.18.2024.10.07.12.30.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Oct 2024 12:30:34 -0700 (PDT) From: Bartosz Golaszewski Date: Mon, 07 Oct 2024 21:30:24 +0200 Subject: [PATCH libgpiod 3/3] dbus: client: monitor: free the line list at exit Precedence: bulk X-Mailing-List: linux-gpio@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20241007-dbus-memory-fixes-v1-3-0d56d1aa032d@linaro.org> References: <20241007-dbus-memory-fixes-v1-0-0d56d1aa032d@linaro.org> In-Reply-To: <20241007-dbus-memory-fixes-v1-0-0d56d1aa032d@linaro.org> To: Kent Gibson , Linus Walleij Cc: Bartosz Golaszewski , linux-gpio@vger.kernel.org X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=770; i=bartosz.golaszewski@linaro.org; h=from:subject:message-id; bh=3/+o3BcGcLYfNKNjs4DPFBqO2wzb8ih7h84HYaGdD+c=; b=owEBbQKS/ZANAwAKARGnLqAUcddyAcsmYgBnBDbYsfrFAGEG/fziQ9mECG0UeCcuJPZBg265u X8T1j9QTwCJAjMEAAEKAB0WIQQWnetsC8PEYBPSx58Rpy6gFHHXcgUCZwQ22AAKCRARpy6gFHHX cle2EACChVTHn/ZPSGb59GFaIMMR8xHmBmc0nPV3k51m5RUw75VIYUAuRGttjdfmP2Creq18HLb H9d16jhE0DZgxVT34mldfSBbTbL1/+ZVsdJmW1vMh8LTOdP9aTqFc6NswuTKoCpMcMFX8twQPhS 2jYgO8+4tRevrF92WQR/OpT0fLrFq1BVxHurwVJQIhgMBtZms1iLZ40VlbcHOsUf3MkSqGb0HR2 Gh2YF+dhLuwANj3MvPp/Uiv+b+i7H8ppaY4Ff8JLmDyKQ0lKXMY3YIOXP3IDB66mB7f+HRXb63j Lwd8flIvkjxjGIDbuNaxXi/ZLr2pDGT3HAQTIrOApP3fTprC/Ww6X8AgHiHvQHEI7t0hOq5QDU9 tpIzHqxphf1+ZZsTAKxPb8yMNUh8c/Pnws/EDlk/+IaYIxw4Rpo9D1HIzGX6YTDJEjOlNovda6o 61fi1wmzIQK7C56e1cVtWndTNu6wtxwdI8JY6ciBVJRYUJAOwHoY0BjDuGehf0z79vwjeIquI40 myKA4KbL8hoZvltaoYj9mAenft0wIz8Xu3HyJwUmVyplegwiLTZv+D35qrZYCIrYsKNcDkCDE4X JxWBUNkY44KiUDONUTW0pyAFLnQ+5sZY9TaWtKsbDit1ZJz4A/IDZ389AV0980xA91LSjf50kBL TmLnqbDAFNt43mA== X-Developer-Key: i=bartosz.golaszewski@linaro.org; a=openpgp; fpr=169DEB6C0BC3C46013D2C79F11A72EA01471D772 From: Bartosz Golaszewski Free the list of line proxies stored for the duration of the program at exit to fix a memory leak. Note: these objects need to be kept alive for D-Bus events to work. Fixes: a5ab76da1e0a ("dbus: add the D-Bus daemon, command-line client and tests") Signed-off-by: Bartosz Golaszewski --- dbus/client/monitor.c | 1 + 1 file changed, 1 insertion(+) diff --git a/dbus/client/monitor.c b/dbus/client/monitor.c index 3bd25b8..df7eb51 100644 --- a/dbus/client/monitor.c +++ b/dbus/client/monitor.c @@ -185,6 +185,7 @@ int gpiocli_monitor_main(int argc, char **argv) g_main_loop_run(loop); + g_list_free_full(data.lines, g_object_unref); g_bus_unwatch_name(watch_id); return EXIT_SUCCESS;