X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;f=src%2Fvcl%2Fldp.c;h=915d1caa40c0074767ca6ee3d4c206463f3416c8;hb=47c40e2d944c9a29677d0542103207ba8372b66a;hp=5c70643ed2444ccdbb5dcbe46e5f4b97d91c2c96;hpb=743ee3e12531ec3c6ba2e2add694dde3361b0e03;p=vpp.git diff --git a/src/vcl/ldp.c b/src/vcl/ldp.c index 5c70643ed24..915d1caa40c 100644 --- a/src/vcl/ldp.c +++ b/src/vcl/ldp.c @@ -346,7 +346,7 @@ ldp_init (void) int close (int fd) { - int rv; + int rv, refcnt; const char *func_str; u32 sid = ldp_sid_from_fd (fd); @@ -388,13 +388,15 @@ close (int fd) LDBG (0, "LDP<%d>: fd %d (0x%x): calling %s(): sid %u (0x%x)", getpid (), fd, fd, func_str, sid, sid); + refcnt = vppcom_session_attr (sid, VPPCOM_ATTR_GET_REFCNT, 0, 0); rv = vppcom_session_close (sid); if (rv != VPPCOM_OK) { errno = -rv; rv = -1; } - ldp_fd_free_w_sid (sid); + if (refcnt == 1) + ldp_fd_free_w_sid (sid); } else {