Article View: linux.kernel.git
Article #3190Re: [Outreachy PATCH v2 1/2] apply: reject a patch after an empty "diff --git" line
From: Tanga Joris
Date: Mon, 16 Nov 2026 17:54
Date: Mon, 16 Nov 2026 17:54
23 lines
12697 bytes
12697 bytes
Hi Siddharth, Thank you for reviewing this. On Sun, 15 Nov 2026 at 15:39, Siddharth Asthana <siddharthasthana31@gmail.com> wrote: > The leak is actually in parse_git_diff_header(), we overwrite > patch->def_name without freeing the old value, so it leaks when the > function runs again for the next "diff --git". A free() before the > assignment fixes it, and both callers zero the patch first so it's safe. > Can't we do that in a prep patch and keep the test? Yes, I tried it. With the free(), the test passes under SANITIZE=leak, so I'll add it as a preparatory patch in v3 and keep the test. > Nit: the notes under "---" describe both patches, so a cover letter with > "--cover-letter --range-diff=<v2>" would be nicer for v3. Alright, I'll send v3 with a cover letter and a range-diff. Thanks, Tanga
Technical Details
Message-ID:
<CAKrRMNq44ybUc3y-iMPrDHauQ0ST2z99KPYKBXwzkGsE-GwQLA@mail.gmail.com>Path:
mbox-mo1.pugleaf.net!news-lax.pugleaf.net!srl.newsdeef.eu!news.mb-net.net!open-news-network.org!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!git+bounces-75555-linux-kernel-git=dewy.ruReferences:
<20261107195429.96842-1-tangajoris@gmail.com> <20261114012055.127905-1-tangajoris@gmail.com> <d4c22268-44e0-4e33-9ad4-2a9b3a5f5cae@gmail.com>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!srl.newsdeef.eu!news.mb-net.net!open-news-network.org!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!git+bounces-75555-linux-kernel-git=dewy.ru
From: tangajoris@gmail.com (Tanga Joris)
Newsgroups: linux.kernel.git
Subject: Re: [Outreachy PATCH v2 1/2] apply: reject a patch after an empty
"diff --git" line
Date: Mon, 16 Nov 2026 20:54:21 +0300
Organization: Usenet Network
Message-ID: <CAKrRMNq44ybUc3y-iMPrDHauQ0ST2z99KPYKBXwzkGsE-GwQLA@mail.gmail.com>
References: <20261107195429.96842-1-tangajoris@gmail.com> <20261114012055.127905-1-tangajoris@gmail.com>
<d4c22268-44e0-4e33-9ad4-2a9b3a5f5cae@gmail.com>
MIME-Version: 1.0
Content-Type: text/plain; charset="UTF-8"
Injection-Info: usenet.network;
logging-data="2128705"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:pV6CzOCcnyuHra5qXmfMddB/W0A= sha256:S0DPCszg2HL55xTfXnlGIlps9TzthVcFiEOPrtFA0Js=
sha1:z9Dw9nA2KVemk9cR9Bp1j7LY3mA= sha256:DypMW9lKymFJHJmmzaqLmfpj5Dohz44AfGnF9ISvAqI=
List-ID: <git.vger.kernel.org>
X-Mailpost-Empty-Hdrs: X-Spam-Level
X-Received: from localhost (localhost [127.0.0.1])
by mail.dewy.ru (Postfix) with ESMTP id 43309114D15; Mon, 16 Nov 2026 20:55:23 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.049
X-Spam-Status: No, score=-3.049 tagged_above=-9999 required=6.31
tests=[DCC_REPUT_70_89=0.1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1,
DKIM_VALID_AU=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.001,
FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.249,
MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001,
SPF_PASS=-0.001] autolearn=ham autolearn_force=no
X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key)
header.d=gmail.com
X-Received: from mail.dewy.ru ([127.0.0.1])
by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024)
with ESMTP id 4ZvuT5-eFkZC;
Mon, 16 Nov 2026 20:55:19 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=git+bounces-75555-linux-kernel-git=dewy.ru@vger.kernel.org; receiver=<UNKNOWN>
X-Authentication-Results: OpenDMARC; dmarc=fail (p=none dis=none) header.from=gmail.com
X-Received: from sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10])
by mail.dewy.ru (Postfix) with ESMTPS id 74FCE114D10; Mon, 16 Nov 2026 20:55:10 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
by sea.lore.kernel.org (Postfix) with ESMTP id 361EA2E5DC; Mon, 16 Nov 2026 17:55:01 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-ARC-Seal: i=3; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass;
t=1794851700;
b=IKPU8lZuo/Wzv2jRtgcwdjSkOEJw4h5fhHEeM6vj3ItoI0Y5lETblYj1Y6O4eqrM7kQh
+cf1PrijjFfUZs5c590egDYFhEMZxo8qeqcyLaHaWlepLM6u35bkywimgQNkTmAFc3K6g
Ikjp0201Lt5nsz/nUOaFtvWoTdzwGFBS92aY8vcRpL/jYTS6zGcaYOBuNIIWU9RY/FfzB
CuRs0zVhNjC2RZ43PiqnPpHumPKQd1KHyOwYfq5/DlsSfGxSrZSHOda+1t5hnPQ3bzP6j
znhiNdM6wQ/CI/DyB+GsnPdsSIpUGBJWgaABgTEXHQkhk8fTnC3CiUPCkOSkRjN6p3Q==
X-ARC-Message-Signature: i=3; d=subspace.kernel.org; s=arc20261015;
a=rsa-sha256; c=relaxed/relaxed; t=1794851700;
h=X-Original-To:Received:DMARC-Filter:Received:DKIM-Signature:
X-Google-DKIM-Signature:X-Forwarded-Encrypted:X-Gm-Message-State:
X-Gm-Gg:X-Received:X-Mailing-List:List-Id:List-Post:List-Help:
List-Subscribe:List-Unsubscribe:List-Owner:Precedence:MIME-Version:
References:In-Reply-To:From:Date:X-Gm-Features:Message-ID:Subject:To:
Cc:Content-Type;
bh=RsYkkrCytPYpChFLW5RYMcccomIpp/ZaiKlFN19Y55I=;
b=JBFh89K0byYR93N4ba5UZKx9ipVI9DxRF8zuJ8UEO1ETOmoKVOoqSbznXhJsBDaZARUd
oTvhLj+kDGR/iMEcs2wJ++e2pOs3gfUyfwjInSFElPCPD/jb+vQgmXH3V3+DYfjD51HVW
tVkJTLLgfbbGWel7KU0v6da+/zf/ORTms1PS1FGrcxd1Tp2v8s7UE2ydXLat0ym/xGIQa
BNBKdWfRRxoy2ByFeEcdNPdFImYtveb4HZEvdYaAx0fkTAu1GtW3q9uSqwmJc87b8k5Jh
lf9N9p7lDMZayHvKxvlcQjcGkcmsz9Uo4lFZELPywhkBMbtqDGSY9FFt1Kaoo3+/c/A==
X-ARC-Authentication-Results: i=3; smtp.subspace.kernel.org;
dkim=pass header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=qPJKFM3T;
dmarc=pass header.from=gmail.com;
spf=pass smtp.mailfrom=gmail.com;
arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-Received: from localhost.localdomain (localhost [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 90F4D606A891;
Mon, 16 Nov 2026 17:55:00 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=qPJKFM3T
X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=209.85.160.43
X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass;
t=1794851699;
b=27h/+Wt+QE6S71O96fg1VO2HOZmQMD/Jthu5W++HUD1oqMBkj/LBbLY6xYRt0FIF3lXF
Qjzw2pC/VU6H6K+yHnoudQkmK4ywMDZEZxUACFN2W1ZO+ogCSUDPhgyIT6KtoTqpu6QOH
4pCMGe5SM7+6BFznPW4DRW2lE1TwcdwnhSLwN46els1agPHh5Vs+HsfjilWzFI0tIINOR
VEeu4TX7wYGSWwHzvPImg+EyMCFTzJJ7vpIhIahcGFDu3ExEtCekfqI6w4UmmsnDyhYl/
4micii09F8yNzJYJTz5OcGpX4Rng4h8aemaYWxjpteCEtMMDKa5+fbQy6Oi4bKBYjkA==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
a=rsa-sha256; c=relaxed/relaxed; t=1794851699;
h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature:
X-Forwarded-Encrypted:X-Gm-Message-State:X-Gm-Gg:X-Received:
MIME-Version:References:In-Reply-To:From:Date:X-Gm-Features:
Message-ID:Subject:To:Cc:Content-Type;
bh=RsYkkrCytPYpChFLW5RYMcccomIpp/ZaiKlFN19Y55I=;
b=DJUsld7Pqehb65feUrh8P+xdWDq2kktyXUrm6E8SKwMfIwql9KNtOc40oE0Yd4dLRS8g
2syKbNl4klT4HVkXXV645E9tGN5NAZYhP6Mps/C0dDwBzWQoySJGpbF0n2tHUpF0e8Tdm
xQI4RU0kTKFQfFS7qAV7tmsXjqitNO6Ont02Ybpe+v+1FxQL5qTQ4ItHSotyRvqaLja4f
itrVdpcOQc1u1K4C8aDvs0jv+Ts0r1xXxzAQO1JfUYul3M1nc9KY9qOPRwrnYGg2WAgAt
tXSnY2I+o+JexNSSpErncm9+8nB97CvMFsLC5NN6V90Mlokl3GjR1XttMzl2Cz6Yjcw==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org;
dmarc=pass header.from=gmail.com;
spf=pass smtp.mailfrom=gmail.com;
dkim=pass header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=qPJKFM3T;
arc=pass header.oldest-pass=0 smtp.remote-ip=209.85.160.43
X-Received: from mail-oa1-f43.google.com (mail-oa1-f43.google.com [209.85.160.43])
(using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)
key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256)
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6645E606A894
for <git@vger.kernel.org>; Mon, 16 Nov 2026 17:54:59 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 6645E606A894
X-Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com
X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com
X-Received: by mail-oa1-f43.google.com with SMTP id 586e51a60fabf-4932b13c4ccso2600882fac.3
for <git@vger.kernel.org>; Mon, 16 Nov 2026 09:54:59 -0800 (PST)
X-ARC-Seal: i=1; a=rsa-sha256; t=1794851698; cv=none;
d=google.com; s=arc-20260327;
b=G3UN8SClj95gRJbeDZy92a5bWygkiZlae0cJHozQT8/LiaZTAG34geIaJzYCFmp/FG
FcemL7wgS6aD/6D2UFAEl+sJpd9BkEecus5Z4j93FLFEIN4ljsiFTrH8bKOAImbm0LmG
xcbEhbdsGlRqAiXzm8AGKetOEn+PrGW/4DRpkXYtOT7JTmifpNwZtZGbTpbjMH01waNL
1lM88lyclayyDxbHwe9J+6LbyHhVqyfd/1nmcAAI1VI4FPQgOR/1jQorsiuWHahyQ1+O
wibCaBZh6fGnzaLhydUzWUJVybbig5FyEmX4rDkDTDeShaNF730MIM77Ljoi9ZyTy4zU
Fg2w==
X-ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20260327;
h=cc:to:subject:message-id:date:from:in-reply-to:references
:mime-version:dkim-signature;
bh=RsYkkrCytPYpChFLW5RYMcccomIpp/ZaiKlFN19Y55I=;
fh=i9vsaPPshn7u+XwFiZFqNCRDG4JV4Hxz6+h1mCSMxb0=;
b=miUmVwcgDeVX8gZfUr3pZ9F6uT4wUDKWGYyUEHB4HvirQ/Xs9t58JqCO0/7Xgre5VN
mfu8rXWjid+V66xyoNnedWJu5iwLmKs/F7b9IYR0ftkgOc3dzTU5esayPhjyAuUjruKT
iZ9+GowJ5wKYRGLh1Jl13AV5ylGuoPN2UnsMb4TQcBkhMZJ+k9qpznf60Zxy4fK0E98t
j4FykUoL6SDz7A9LujblwOla5uJvz9twQ4badWiugLR2UPanm0Zd+xnQNlnXsEvcHFhy
urpmUNeOzM+ijvB04t0AKteFrNqzfnW6Kimoe5TLcK2WPq+YgA8yZdK+uxmBgWG4Chsy
pO9w==;
darn=vger.kernel.org
X-ARC-Authentication-Results: i=1; mx.google.com; arc=none
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=gmail.com; s=20260707; t=1794851698; x=1795456498; darn=vger.kernel.org;
h=content-type:cc:to:subject:message-id:date:from:in-reply-to
:references:mime-version:from:to:cc:subject:date:message-id:reply-to
:content-type;
bh=RsYkkrCytPYpChFLW5RYMcccomIpp/ZaiKlFN19Y55I=;
b=qPJKFM3TXuumLmdR7IYMX0f/wLzTzp7HmlfT9gAfwwLg8bGPvDU732JNvqRc7msDaB
T5LnK1rBeu0HgVxWggTGVzuJ3G2m5H3kbidsZBvwbAeqpeIYTd0LcTISF9gVlxwOZkd1
ocsELNZaerSjJFB4/kxDJBpBd+dhb//DefXWD8tnILSn0CxPjo92DeEEG6G/yXvIPQ5M
ZPD85F+Bw2nz1LDTANdJJFim0mIpaRMfx14K4pqRBtrU+w3NPYWmkU5qVEcQM/p4BMFo
s676uOR8YaMEZaeBWWjieAD/9GHQwcYedYfhS9g7rSgNm6lXGCh6IZQvjmZKRCJ6mFic
vYMw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20260707; t=1794851698; x=1795456498;
h=content-type:cc:to:subject:message-id:date:from:in-reply-to
:references:mime-version:x-gm-gg:x-gm-message-state:from:to:cc
:subject:date:message-id:reply-to:content-type;
bh=RsYkkrCytPYpChFLW5RYMcccomIpp/ZaiKlFN19Y55I=;
b=apVS34F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XYnRr981BGf6N/tFWjt
NrkBZTHTO1Zx7x1POJZSeQPqC63UHP80FxrfojqP6PhQ26jZ+INC2w8g==
X-Received: by 2002:a05:6870:ac29:b0:49d:999d:c25a with SMTP id
586e51a60fabf-4afdf16402amr8598809fac.6.1794851698366; Mon, 16 Nov 2026
09:54:58 -0800 (PST)
X-Mailing-List: git@vger.kernel.org
X-List-Post: <mailto:git@vger.kernel.org>
X-List-Help: <mailto:git+help@vger.kernel.org>
X-List-Subscribe: <mailto:git+subscribe@vger.kernel.org>
X-List-Unsubscribe: <mailto:git+unsubscribe@vger.kernel.org>
X-List-Owner: <mailto:git+owner@vger.kernel.org>
X-Precedence: list
X-In-Reply-To: <d4c22268-44e0-4e33-9ad4-2a9b3a5f5cae@gmail.com>
X-Gm-Features: AclHuK9jGeapvMJ2PhkmvWveIKi9xwTobIrGNZ_IbvFL8yYNyuFcUMX5D90cGT0
X-Cc: phillip.wood@dunelm.org.uk, gitster@pobox.com, jackrawlings2011@gmail.com,
christian.couder@gmail.com, kaartic.sivaraam@gmail.com,
usmanakinyemi202@gmail.com