From ac0c9aeec65ab5ae3bf1606a9ad44e324c164f98 Mon Sep 17 00:00:00 2001 From: Thomas Schmitt Date: Thu, 19 May 2011 13:38:14 +0000 Subject: [PATCH] Replaced some large local variables by other means in xorriso/check_media.c --- libisoburn/trunk/xorriso/check_media.c | 17 +++++++++++++---- libisoburn/trunk/xorriso/xorriso_timestamp.h | 2 +- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/libisoburn/trunk/xorriso/check_media.c b/libisoburn/trunk/xorriso/check_media.c index a70062b4..2ede8894 100644 --- a/libisoburn/trunk/xorriso/check_media.c +++ b/libisoburn/trunk/xorriso/check_media.c @@ -284,7 +284,11 @@ int Sectorbitmap_from_file(struct SectorbitmaP **o, char *path, char *msg, { int ret, fd= -1, sectors, sector_size, i, todo, map_size, skip; unsigned char *map; - unsigned char buf[1024]; + unsigned char *buf; + + buf= TSOB_FELD(unsigned char, 1024); + if(buf == NULL) + return(-1); *os_errno= 0; if(msg != NULL) @@ -296,7 +300,7 @@ int Sectorbitmap_from_file(struct SectorbitmaP **o, char *path, char *msg, strcpy(msg, "Cannot open path "); Text_shellsafe(path, msg+strlen(msg), 0); } - return(0); + {ret= 0; goto ex;} } ret= read(fd, buf, 32); if(ret < 32) { @@ -354,6 +358,8 @@ wrong_filetype:; ex:; if(fd != -1) close(fd); + if(buf != NULL) + free(buf); if(ret <= 0) Sectorbitmap_destroy(o, 0); return(ret); @@ -829,14 +835,16 @@ int Xorriso_check_media_list_job(struct XorrisO *xorriso, char *report, int flag) { int all, ret; - char default_report[161], quality_name[80]; + char *default_report= NULL, quality_name[80]; struct CheckmediajoB *dflt= NULL; + Xorriso_alloc_meM(default_report, char, 161); + all= !(flag&1); report[0]= 0; ret= Checkmediajob_new(&dflt, 0); if(ret <= 0) - return(-1); + {ret= -1; goto ex;} sprintf(report, "-check_media_defaults"); if(!all) strcat(report, " reset=now"); @@ -911,6 +919,7 @@ ex:; Checkmediajob_destroy(&dflt, 0); sprintf(default_report, "-check_media_defaults reset=now %s", xorriso->list_delimiter); + Xorriso_free_meM(default_report); if(ret > 0 && strcmp(report, default_report) == 0) return(2); return(ret); diff --git a/libisoburn/trunk/xorriso/xorriso_timestamp.h b/libisoburn/trunk/xorriso/xorriso_timestamp.h index f3590223..5002bead 100644 --- a/libisoburn/trunk/xorriso/xorriso_timestamp.h +++ b/libisoburn/trunk/xorriso/xorriso_timestamp.h @@ -1 +1 @@ -#define Xorriso_timestamP "2011.05.19.133735" +#define Xorriso_timestamP "2011.05.19.133840"