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

OpenFilesScreen update #235

Merged
merged 1 commit into from
Oct 10, 2020
Merged

OpenFilesScreen update #235

merged 1 commit into from
Oct 10, 2020

Conversation

cgzones
Copy link
Member

@cgzones cgzones commented Oct 9, 2020

- Remove local types and function from header file
- Reduce OpenFiles_Data to neccessary size
- Print file access mode (r/w/u)
- Fix memory leak on consecutive items without an intermediate file item:

    ==15257==ERROR: LeakSanitizer: detected memory leaks

    Direct leak of 120 byte(s) in 12 object(s) allocated from:
        #0 0x48c864 in strdup (htop/htop+0x48c864)
        #1 0x542f68 in xStrdup htop/XAlloc.c:71:17
        #2 0x50e225 in OpenFilesScreen_getProcessData htop/OpenFilesScreen.c:112:25
        htop-dev#3 0x50cd17 in OpenFilesScreen_scan htop/OpenFilesScreen.c:141:35
        htop-dev#4 0x4fd3eb in InfoScreen_run htop/InfoScreen.c:81:35
        htop-dev#5 0x4d58bb in actionLsof htop/Action.c:361:4
        htop-dev#6 0x501766 in MainPanel_eventHandler htop/MainPanel.c:80:19
        htop-dev#7 0x5289fa in ScreenManager_run htop/ScreenManager.c:227:19
        htop-dev#8 0x4f748e in main htop/htop.c:300:4
        htop-dev#9 0x7ff73e0d8cc9 in __libc_start_main csu/../csu/libc-start.c:308:16

    SUMMARY: AddressSanitizer: 120 byte(s) leaked in 12 allocation(s).
Copy link
Member

@BenBE BenBE left a comment

Choose a reason for hiding this comment

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

LGTM.

Just a minor style note: In the long switch statement you could consider to just add a default: label to indicate all, not just the known columns, to be ignored.

@cgzones
Copy link
Member Author

cgzones commented Oct 9, 2020

In the long switch statement you could consider to just add a default: label to indicate all, not just the known columns, to be ignored.

The body of that case statement is empty, so every compiler should drop it entirely; it's mainly a in-code documentation which fields are deliberately ignored.

@cgzones cgzones merged commit f8b9ced into htop-dev:master Oct 10, 2020
@cgzones cgzones deleted the openfiles branch October 10, 2020 09:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants