git: f8145bd4bcc0 - stable/12 - fsck_ufs: fix segfault with gjournal

From: Robert Wing <rew_at_FreeBSD.org>
Date: Sat, 20 Nov 2021 18:33:51 UTC
The branch stable/12 has been updated by rew:

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

commit f8145bd4bcc025fbb1750d9daf75e92916db4192
Author:     Robert Wing <rew@FreeBSD.org>
AuthorDate: 2021-06-03 01:41:31 +0000
Commit:     Robert Wing <rew@FreeBSD.org>
CommitDate: 2021-11-20 18:24:06 +0000

    fsck_ufs: fix segfault with gjournal
    
    The segfault was being hit in closedisk() while trying to free a
    non-pointer.
    
    The fix for this bug differs between stable/12 and stable/13.
    
    PR:             245907
    Submitted by:   longwitz@incore.de
    Differential Revision:  https://reviews.freebsd.org/D30537
    
    (cherry picked from commit 441e69e419effac0225a45f4cdb948280b8ce5ab)
---
 sbin/fsck_ffs/gjournal.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/sbin/fsck_ffs/gjournal.c b/sbin/fsck_ffs/gjournal.c
index b9bfd1bfcced..dca08278569d 100644
--- a/sbin/fsck_ffs/gjournal.c
+++ b/sbin/fsck_ffs/gjournal.c
@@ -246,7 +246,6 @@ closedisk(void)
 		err(1, "sbwrite(%s)", devnam);
 	if (ufs_disk_close(diskp) == -1)
 		err(1, "ufs_disk_close(%s)", devnam);
-	free(diskp);
 	diskp = NULL;
 	fs = NULL;
 }