summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/ImageMetaData.cxx5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/ImageMetaData.cxx b/src/ImageMetaData.cxx
index 5e0102a..cfa699e 100644
--- a/src/ImageMetaData.cxx
+++ b/src/ImageMetaData.cxx
@@ -215,8 +215,11 @@ ImageMetaData::save_image_jpgcom(char *in_img, char *out_img) {
int status, err = 0;
ssize_t n;
int tmp_fd;
+ char *dirbuf;
- snprintf(tmpname, sizeof(tmpname), "%s/.gipfelXXXXXX", dirname(out_img));
+ dirbuf = strdup(out_img);
+ snprintf(tmpname, sizeof(tmpname), "%s/.gipfelXXXXXX", dirname(dirbuf));
+ free(dirbuf);
tmp_fd = mkstemp(tmpname);
if (tmp_fd < 0) {
perror("mkstemp");