From 2c5b9563cbf4312ad7220c95da8842c5c75bf934 Mon Sep 17 00:00:00 2001 From: Thomas White Date: Sat, 18 Sep 2010 15:58:25 +0200 Subject: cubeit: Fixes --- src/cubeit.c | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/src/cubeit.c b/src/cubeit.c index 11f4d555..ebe1bb5f 100644 --- a/src/cubeit.c +++ b/src/cubeit.c @@ -240,6 +240,7 @@ static void process_image(struct process_args *pargs) } free(image.data); + cell_free(pargs->cell); if ( image.flags != NULL ) free(image.flags); hdfile_close(hdfile); } @@ -591,16 +592,27 @@ int main(int argc, char *argv[]) /* Start threads off */ for ( i=0; ifilename, 1023, "%s%s", prefix, line); + /* Get the next filename */ + rval = find_chunk(fh, &cell, &filename); + if ( rval == 1 ) break; + if ( config_basename ) { + char *tmp; + tmp = basename(filename); + free(filename); + filename = tmp; + } + snprintf(pargs->filename, 1023, "%s%s", + prefix, filename); + pargs->cell = cell; + free(filename); n_images++; @@ -657,6 +669,7 @@ int main(int argc, char *argv[]) snprintf(pargs->filename, 1023, "%s%s", prefix, filename); pargs->cell = cell; + free(filename); n_images++; @@ -668,9 +681,6 @@ int main(int argc, char *argv[]) pargs->start = 1; pthread_mutex_unlock(&pargs->control_mutex); - cell_free(cell); - free(filename); - } } while ( rval != NULL ); -- cgit v1.2.3