Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixbug memory leak #271

Open
wants to merge 1 commit into
base: next
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 11 additions & 9 deletions src/xdr_mem.c
Original file line number Diff line number Diff line change
Expand Up @@ -193,15 +193,17 @@ xdrmem_putbufs(XDR *xdrs, xdr_uio *uio, u_int flags)
(unsigned long) XDR_GETPOS(xdrs));
}

if (!(--uio->uio_references)) {
if (uio->uio_release) {
uio->uio_release(uio, UIO_FLAG_NONE);
} else {
__warnx(TIRPC_DEBUG_FLAG_ERROR,
"%s() memory leak, unexpected or no release flags (%u)\n",
__func__, uio->uio_flags);
abort();
}
if (uio->uio_references == 0){
uio->uio_references = 1;
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add a comment here explaining because otherwise that code looks really odd.


if (uio->uio_release) {
uio->uio_release(uio, UIO_FLAG_NONE);
} else {
__warnx(TIRPC_DEBUG_FLAG_ERROR,
"%s() memory leak, unexpected or no release flags (%u)\n",
__func__, uio->uio_flags);
abort();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please fix the indentation on this block

}

return (TRUE);
Expand Down