git: 51b4c4751acd - stable/12 - vdev_read_pad2: freeing wrong pointer

From: Kyle Evans <kevans_at_FreeBSD.org>
Date: Fri, 08 Oct 2021 06:10:31 UTC
The branch stable/12 has been updated by kevans:

URL: https://cgit.FreeBSD.org/src/commit/?id=51b4c4751acd3730b1ce0c8fa937f51beacde920

commit 51b4c4751acd3730b1ce0c8fa937f51beacde920
Author:     Toomas Soome <tsoome@FreeBSD.org>
AuthorDate: 2020-02-05 05:42:42 +0000
Commit:     Kyle Evans <kevans@FreeBSD.org>
CommitDate: 2021-10-08 02:41:17 +0000

    vdev_read_pad2: freeing wrong pointer
    
    Shoud free previously allocated tmp buffer instead. Issue introduced in
    r357497.
    
    (cherry picked from commit a1746b25837c2df4367eed7e8c3665e26e0dc6bb)
---
 stand/i386/zfsboot/zfsboot.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/stand/i386/zfsboot/zfsboot.c b/stand/i386/zfsboot/zfsboot.c
index c6b69867b0f4..e5da51b13b7d 100644
--- a/stand/i386/zfsboot/zfsboot.c
+++ b/stand/i386/zfsboot/zfsboot.c
@@ -337,7 +337,7 @@ vdev_read_pad2(vdev_t *vdev, char *buf, size_t size)
 	rc = vdev_read_phys(vdev, &bp, tmp, off, 0);
 	if (rc == 0)
 		memcpy(buf, tmp, size);
-	free(buf);
+	free(tmp);
 	return (rc);
 }