diff options
author | Daniel Friesel <derf@chaosdorf.de> | 2017-04-02 15:04:39 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-04-02 15:04:39 +0200 |
commit | d10e92219d10b0fbbd17fc856d4eb692dec20516 (patch) | |
tree | 56636e5f1f8e0a9cefec43218b2f82a9c074978e /src/utils.c | |
parent | b6bc4ef76aa1d06ba4af913dc9a112d5b14c4bba (diff) | |
parent | 08dbe8e2f2ab097257e1139f3b246ddf9585bcce (diff) |
Merge pull request #289 from stoeckmann/memory-leak
Fixed memory leak on file name collision.
Diffstat (limited to 'src/utils.c')
-rw-r--r-- | src/utils.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/src/utils.c b/src/utils.c index 2c0809c..fdd4c22 100644 --- a/src/utils.c +++ b/src/utils.c @@ -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); |