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
v-0.4.0
Al Poole 5 years ago committed by Carsten Haitzler (Rasterman)
parent b3cb2d20a7
commit 6e2b560ed4
  1. 21
      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);

Loading…
Cancel
Save