diff --git a/src/gui-dialogs.c b/src/gui-dialogs.c index b1ddae9..cec2de4 100644 --- a/src/gui-dialogs.c +++ b/src/gui-dialogs.c @@ -2705,6 +2705,7 @@ mo_status mo_edit_source(mo_window *win) { char *sourceFileName; FILE *fp; + int fd; int length; char *editorName; char execString[1024]; @@ -2748,10 +2749,10 @@ extern void AddChildProcessHandler(int, void (*)(), void *); /* write out source to tmp file with .html extension */ sourceFileName = malloc(255); - strcpy(sourceFileName, tmpnam(NULL)); - strcat(sourceFileName, ".html"); + strncpy(sourceFileName, "mosaic-XXXXXX.html\0", 19); + fd = mkstemps(sourceFileName, 5); - if (!(fp = fopen(sourceFileName,"w"))) + if (!(fp = fdopen(fd, "w"))) { char *buf, *final, tmpbuf[80]; int final_len; diff --git a/src/readPNG.c b/src/readPNG.c index 74b90e3..3c63457 100644 --- a/src/readPNG.c +++ b/src/readPNG.c @@ -383,8 +383,6 @@ ReadPNG(FILE *infile,int *width, int *height, XColor *colrs) q++; /* skip the alpha pixel */ } } - - free((char *)png_pixels); } else { @@ -400,11 +398,9 @@ ReadPNG(FILE *infile,int *width, int *height, XColor *colrs) *p++ = *q++; /*palette index*/ } } - - free((char *)png_pixels); - } + free((char *)png_pixels); free((png_byte **)row_pointers); /* clean up after the read, and free any memory allocated */