diff options
| author | Jose Luis Duran <jlduran@FreeBSD.org> | 2026-07-13 12:23:14 +0000 |
|---|---|---|
| committer | Jose Luis Duran <jlduran@FreeBSD.org> | 2026-07-13 12:23:14 +0000 |
| commit | fcaf15e54162fe14483fdf4ac28c67c51e424441 (patch) | |
| tree | 01dcc57d6777edf9b5f56d782457260b338bc341 | |
| parent | f2f50c80ae27a97a66b8d4a1b5dd6ee9d63ff18f (diff) | |
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
| -rw-r--r-- | lib/libnetmap/nmport.c | 4 |
1 files changed, 3 insertions, 1 deletions
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); |
