Skip to content

Commit

Permalink
Free local string variable on error path when parsing elf notes from …
Browse files Browse the repository at this point in the history
…memfd-backed file
  • Loading branch information
dalehamel committed Apr 18, 2019
1 parent c36f5bf commit 7caf21a
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/cc/bcc_proc.c
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,10 @@ static char *_procutils_memfd_path(const int pid, const uint64_t inum) {
strcpy(dirstr, path_buffer);
dirstream = opendir(dirstr);

if (dirstream == NULL)
if (dirstream == NULL) {
free(dirstr);
return NULL;
}

while (path == NULL && (dent = readdir(dirstream)) != NULL) {
snprintf(path_buffer, (PATH_MAX + 1), "%s/%s", dirstr, dent->d_name);
Expand Down

0 comments on commit 7caf21a

Please sign in to comment.