diff options
author | Marcus Meissner <marcus@jet.franken.de> | 2014-07-01 07:54:07 +0000 |
---|---|---|
committer | Marcus Meissner <marcus@jet.franken.de> | 2014-07-01 07:54:07 +0000 |
commit | df0aeac4a893a641fd167516ad2831ddd3ddda1e (patch) | |
tree | ebfcf21de6863e2fe61bc9b312b0a8a4cfbfa7b2 /camlibs/kodak | |
parent | e4354bd7a2f3de1c4f58e5442f55742cb9cbf8a3 (diff) | |
download | libgphoto2-df0aeac4a893a641fd167516ad2831ddd3ddda1e.tar.gz |
free the correct file. move the get_data_and_size out of the loop
git-svn-id: https://svn.code.sf.net/p/gphoto/code/trunk/libgphoto2@15049 67ed7778-7388-44ab-90cf-0a291f65f57c
Diffstat (limited to 'camlibs/kodak')
-rw-r--r-- | camlibs/kodak/dc120/library.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/camlibs/kodak/dc120/library.c b/camlibs/kodak/dc120/library.c index e3b92b733..a592e06ef 100644 --- a/camlibs/kodak/dc120/library.c +++ b/camlibs/kodak/dc120/library.c @@ -451,13 +451,15 @@ static int dc120_get_file_preview (Camera *camera, CameraFile *file, int file_nu /* Create a file for KDC data */ gp_file_new(&f); if (dc120_packet_read_data(camera, f, cmd_packet, size, 1024, context)==GP_ERROR) { - gp_file_free(file); + gp_file_free(f); return (GP_ERROR); } /* Convert to PPM file for now */ gp_file_append(file, "P3\n80 60\n255\n", 13); + + gp_file_get_data_and_size (f, &f_data, &f_size); + for (x=0; x<14400; x+=3) { - gp_file_get_data_and_size (f, &f_data, &f_size); sprintf(buf, "%i %i %i\n", (unsigned char)f_data[x+1280], (unsigned char)f_data[x+1281], @@ -465,7 +467,7 @@ static int dc120_get_file_preview (Camera *camera, CameraFile *file, int file_nu gp_file_append(file, buf, strlen(buf)); } - sleep(1); + sleep(1); /* FIXME: why? */ return (GP_OK); } |