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

Fix a memory leak in glob_for_cachedir() #1671

Merged
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
3 changes: 2 additions & 1 deletion libdnf/hy-iutil.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ glob_for_cachedir(char *path)
if (!g_str_has_suffix(path, "XXXXXX"))
return ret;

wordexp_t word_vector;
wordexp_t word_vector = {0};
char *p = g_strdup(path);
const int len = strlen(p);
struct stat s;
Expand All @@ -98,6 +98,7 @@ glob_for_cachedir(char *path)
p[len-6] = '*';
p[len-5] = '\0';
if (wordexp(p, &word_vector, 0)) {
wordfree(&word_vector);
g_free(p);
return ret;
}
Expand Down
Loading