mirror of
https://github.com/xzeldon/htop.git
synced 2024-12-23 22:55:46 +00:00
fix memory leak
This commit is contained in:
parent
a600d5a6e9
commit
282f16c4b8
@ -91,7 +91,10 @@ static OpenFiles_ProcessData* OpenFilesScreen_getProcessData(int pid) {
|
||||
break;
|
||||
anyRead = true;
|
||||
char* entry = malloc(1024);
|
||||
if (!fgets(entry, 1024, fd)) break;
|
||||
if (!fgets(entry, 1024, fd)) {
|
||||
free(entry);
|
||||
break;
|
||||
}
|
||||
char* newline = strrchr(entry, '\n');
|
||||
*newline = '\0';
|
||||
if (cmd == 'f') {
|
||||
|
Loading…
Reference in New Issue
Block a user