From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id C88A013997D for ; Sat, 9 Nov 2019 10:29:32 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 0C61EE083D; Sat, 9 Nov 2019 10:29:32 +0000 (UTC) Received: from smtp.gentoo.org (dev.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id C56C4E083D for ; Sat, 9 Nov 2019 10:29:31 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id C622C34CB0F for ; Sat, 9 Nov 2019 10:29:30 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 19ACE889 for ; Sat, 9 Nov 2019 10:29:28 +0000 (UTC) From: "Fabian Groffen" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Fabian Groffen" Message-ID: <1573295261.ff773ed5a95fe7d6891455dbee7cd686c4ceef97.grobian@gentoo> Subject: [gentoo-commits] proj/portage-utils:master commit in: libq/ X-VCS-Repository: proj/portage-utils X-VCS-Files: libq/tree.c X-VCS-Directories: libq/ X-VCS-Committer: grobian X-VCS-Committer-Name: Fabian Groffen X-VCS-Revision: ff773ed5a95fe7d6891455dbee7cd686c4ceef97 X-VCS-Branch: master Date: Sat, 9 Nov 2019 10:29:28 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Archives-Salt: 270d610f-0641-47e1-a66c-91991d929d1d X-Archives-Hash: f44fc97bbb063c97f61097397ad91a72 commit: ff773ed5a95fe7d6891455dbee7cd686c4ceef97 Author: Fabian Groffen gentoo org> AuthorDate: Sat Nov 9 10:27:41 2019 +0000 Commit: Fabian Groffen gentoo org> CommitDate: Sat Nov 9 10:27:41 2019 +0000 URL: https://gitweb.gentoo.org/proj/portage-utils.git/commit/?id=ff773ed5 libq/tree: fix crash in tree_get_atom for ebuild mode with SLOT When an ebuild doesn't contain SLOT, but it was requested, just set SLOT to NULL, instead of trying to strdup(NULL). Thanks Joakim Tjernlund Signed-off-by: Fabian Groffen gentoo.org> libq/tree.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/libq/tree.c b/libq/tree.c index a8baabe..b0d0b5b 100644 --- a/libq/tree.c +++ b/libq/tree.c @@ -1014,8 +1014,10 @@ tree_get_atom(tree_pkg_ctx *pkg_ctx, bool complete) if (pkg_ctx->slot == NULL) { tree_pkg_meta *meta = tree_pkg_read(pkg_ctx); if (meta != NULL) { - pkg_ctx->slot = xstrdup(meta->SLOT); - pkg_ctx->slot_len = strlen(pkg_ctx->slot); + if (meta->SLOT != NULL) { + pkg_ctx->slot = xstrdup(meta->SLOT); + pkg_ctx->slot_len = strlen(pkg_ctx->slot); + } tree_close_meta(meta); } }