Replaced some large local variables by other means in libisofs/filesrc.c

This commit is contained in:
Thomas Schmitt 2011-06-11 11:08:20 +02:00
parent f089bcf66a
commit 265df5fbe3

View File

@ -335,11 +335,11 @@ int filesrc_writer_write_data(IsoImageWriter *writer)
{ {
int res, ret, was_error; int res, ret, was_error;
size_t i, b; size_t i, b;
Ecma119Image *t; Ecma119Image *t = NULL;
IsoFileSrc *file; IsoFileSrc *file;
IsoFileSrc **filelist; IsoFileSrc **filelist;
char name[PATH_MAX]; char *name = NULL;
char buffer[BLOCK_SIZE]; char *buffer = NULL;
off_t file_size; off_t file_size;
uint32_t nblocks; uint32_t nblocks;
void *ctx= NULL; void *ctx= NULL;
@ -350,10 +350,11 @@ int filesrc_writer_write_data(IsoImageWriter *writer)
#endif #endif
if (writer == NULL) { if (writer == NULL) {
return ISO_ASSERT_FAILURE; ret = ISO_ASSERT_FAILURE; goto ex;
} }
memset(buffer, 0, BLOCK_SIZE); LIBISO_ALLOC_MEM(name, char, PATH_MAX);
LIBISO_ALLOC_MEM(buffer, char, BLOCK_SIZE);
t = writer->target; t = writer->target;
filelist = writer->data; filelist = writer->data;
@ -562,13 +563,15 @@ ex:;
iso_md5_end(&ctx, md5); iso_md5_end(&ctx, md5);
#ifdef Libisofs_with_libjtE #ifdef Libisofs_with_libjtE
if (jte_begun) { if (jte_begun && t != NULL) {
libjte_end_data_file(t->libjte_handle); libjte_end_data_file(t->libjte_handle);
iso_libjte_forward_msgs(t->libjte_handle, t->image->id, iso_libjte_forward_msgs(t->libjte_handle, t->image->id,
ISO_LIBJTE_END_FAILED, 0); ISO_LIBJTE_END_FAILED, 0);
} }
#endif /* Libisofs_with_libjtE */ #endif /* Libisofs_with_libjtE */
LIBISO_FREE_MEM(buffer);
LIBISO_FREE_MEM(name);
return ret; return ret;
} }