Memory leak on DragonFlyBSD when querying full command line

This commit is contained in:
Benny Baumann 2021-10-03 01:02:45 +02:00 committed by BenBE
parent 57c1538887
commit 9d8d87e1d5
1 changed files with 3 additions and 0 deletions

View File

@ -333,6 +333,7 @@ static void DragonFlyBSDProcessList_updateProcessName(kvm_t* kd, const struct ki
} }
char* cmdline = xMalloc(len); char* cmdline = xMalloc(len);
char* at = cmdline; char* at = cmdline;
int end = 0; int end = 0;
for (int i = 0; argv[i]; i++) { for (int i = 0; argv[i]; i++) {
@ -346,6 +347,8 @@ static void DragonFlyBSDProcessList_updateProcessName(kvm_t* kd, const struct ki
*at = '\0'; *at = '\0';
Process_updateCmdline(proc, cmdline, 0, end); Process_updateCmdline(proc, cmdline, 0, end);
free(cmdline);
} }
static inline void DragonFlyBSDProcessList_scanJails(DragonFlyBSDProcessList* dfpl) { static inline void DragonFlyBSDProcessList_scanJails(DragonFlyBSDProcessList* dfpl) {