summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/slideshow.c9
-rw-r--r--src/utils.c1
2 files changed, 8 insertions, 2 deletions
diff --git a/src/slideshow.c b/src/slideshow.c
index 19aeaee..145bee1 100644
--- a/src/slideshow.c
+++ b/src/slideshow.c
@@ -615,7 +615,10 @@ void slideshow_save_image(winwidget win)
{
char *tmpname;
Imlib_Load_Error err;
- char *base_dir = estrjoin("", opt.output_dir ? opt.output_dir : "", "/", NULL);
+ char *base_dir = "";
+ if (opt.output_dir) {
+ base_dir = estrjoin("", opt.output_dir, "/", NULL);
+ }
if (win->file) {
tmpname = feh_unique_filename(base_dir, FEH_FILE(win->file->data)->name);
@@ -628,7 +631,9 @@ void slideshow_save_image(winwidget win)
tmpname = feh_unique_filename(base_dir, "noname.png");
}
- free(base_dir);
+ if (opt.output_dir) {
+ free(base_dir);
+ }
if (opt.verbose)
fprintf(stderr, "saving image to filename '%s'\n", tmpname);
diff --git a/src/utils.c b/src/utils.c
index ec30d4a..087e7f6 100644
--- a/src/utils.c
+++ b/src/utils.c
@@ -152,6 +152,7 @@ char path_is_url(char *path) {
return 0;
}
+/* Note: path must end with a trailing / or be an empty string */
/* free the result please */
char *feh_unique_filename(char *path, char *basename)
{