Skip to content
Snippets Groups Projects
Commit d10e9221 authored by derf's avatar derf Committed by GitHub
Browse files

Merge pull request #289 from stoeckmann/memory-leak

Fixed memory leak on file name collision.
parents b6bc4ef7 08dbe8e2
No related branches found
No related tags found
No related merge requests found
......@@ -169,9 +169,11 @@ char *feh_unique_filename(char *path, char *basename)
ppid = getpid();
snprintf(cppid, sizeof(cppid), "%06ld", (long) ppid);
tmpname = NULL;
/* make sure file doesn't exist */
do {
snprintf(num, sizeof(num), "%06ld", i++);
free(tmpname);
tmpname = estrjoin("", path, "feh_", cppid, "_", num, "_", basename, NULL);
}
while (stat(tmpname, &st) == 0);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment