raster pushed a commit to branch master.

http://git.enlightenment.org/apps/rage.git/commit/?id=6e2b560ed4bbbef8a68f3ac592113743ac199274

commit 6e2b560ed4bbbef8a68f3ac592113743ac199274
Author: Al Poole <nets...@gmail.com>
Date:   Sun Aug 6 19:04:24 2017 +0900

    thumb: fix optimization conversion, move and free.
    
    Summary:
    fix image save (needs extension). use same extension (saves conversion).
    fix free before use.
    
    Reviewers: raster
    
    Reviewed By: raster
    
    Differential Revision: https://phab.enlightenment.org/D5071
---
 src/bin/thumb.c | 21 ++++++++++++---------
 1 file changed, 12 insertions(+), 9 deletions(-)

diff --git a/src/bin/thumb.c b/src/bin/thumb.c
index e961785..12b5c83 100644
--- a/src/bin/thumb.c
+++ b/src/bin/thumb.c
@@ -191,15 +191,18 @@ _local_artwork_poster(Evas_Object *win, const char 
*path_to_file)
        Evas_Object *artwork = _media_artwork(em, path_to_file);
        if (artwork)
          {
-            char *path2 = alloca(strlen(path) + 4 + 1);
-
-            sprintf(path2, "%s.tmp", path);
-            evas_object_image_save(artwork, path2, NULL, NULL);
-            evas_object_del(artwork);
-            free(path);
-            /* This speeds things up */
-            ecore_file_mv(path2, path);
-            exit(0);
+            const char *ext = strrchr(path, '.');
+            if (ext && (ext[0] && ext[1]))
+              {
+                 char *path2 = alloca(strlen(path) + 4 + strlen(ext) + 1);
+                 sprintf(path2, "%s.tmp%s", path, ext);
+                 evas_object_image_save(artwork, path2, NULL, NULL);
+                 evas_object_del(artwork);
+                 /* This speeds things up */
+                 ecore_file_mv(path2, path);
+                 free(path);
+                 exit(0);
+              }
          }
 
        free(path);

-- 


Reply via email to