The branch main has been updated by jlduran: URL: https://cgit.FreeBSD.org/src/commit/?id=fcaf15e54162fe14483fdf4ac28c67c51e424441
commit fcaf15e54162fe14483fdf4ac28c67c51e424441 Author: Jose Luis Duran <[email protected]> AuthorDate: 2026-07-13 12:23:14 +0000 Commit: Jose Luis Duran <[email protected]> CommitDate: 2026-07-13 12:23:14 +0000 libnetmap: fix error path in nmport_extmem_from_file Reviewed by: zlei, vmaffione Obtained from: https://github.com/luigirizzo/netmap/commit/b52a2bcae35e56548acfb0849b248a1e4b0c0c3b MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D58150 --- lib/libnetmap/nmport.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/libnetmap/nmport.c b/lib/libnetmap/nmport.c index ec9c6136f0f8..c892c94db32e 100644 --- a/lib/libnetmap/nmport.c +++ b/lib/libnetmap/nmport.c @@ -198,6 +198,7 @@ nmport_extmem_from_file(struct nmport_d *d, const char *fname) errno = ENOMEM; goto fail; } + clnup->up.cleanup = NULL; fd = open(fname, O_RDWR); if (fd < 0) { @@ -215,6 +216,7 @@ nmport_extmem_from_file(struct nmport_d *d, const char *fname) goto fail; } close(fd); + fd = -1; clnup->p = p; clnup->size = mapsize; @@ -230,7 +232,7 @@ fail: if (fd >= 0) close(fd); if (clnup != NULL) { - if (clnup->p != MAP_FAILED) + if (clnup->up.cleanup != NULL) nmport_pop_cleanup(d); else nmctx_free(ctx, clnup);
