Prevented use of uninitialized variable in case of memory shortage. Coverity CID 28801.

This commit is contained in:
Thomas Schmitt 2015-11-06 12:34:16 +00:00
parent 7ae48207c7
commit 8ecf0620a7
2 changed files with 7 additions and 14 deletions

View File

@ -1372,13 +1372,9 @@ int Xorriso_show_du_subs(struct XorrisO *xorriso, IsoDir *dir_node,
off_t sub_size, report_size, mem= 0;
char *path= NULL, *show_path= NULL, *sfe= NULL;
sfe= malloc(5*SfileadrL);
path= malloc(SfileadrL);
show_path= malloc(SfileadrL);
if(path==NULL || show_path==NULL || sfe==NULL) {
Xorriso_no_malloc_memory(xorriso, &sfe, 0);
{ret= -1; goto ex;}
}
Xorriso_alloc_meM(sfe, char, 5 * SfileadrL);
Xorriso_alloc_meM(path, char, SfileadrL);
Xorriso_alloc_meM(show_path, char, SfileadrL);
*size= 0;
ret= iso_dir_get_children(dir_node, &iter);
@ -1490,12 +1486,9 @@ much_too_long:;
}
ret= 1;
ex:;
if(sfe!=NULL)
free(sfe);
if(path!=NULL)
free(path);
if(show_path!=NULL)
free(show_path);
Xorriso_free_meM(sfe);
Xorriso_free_meM(path);
Xorriso_free_meM(show_path);
if(iter!=NULL)
iso_dir_iter_free(iter);
if(node_array!=NULL)

View File

@ -1 +1 @@
#define Xorriso_timestamP "2015.11.06.092940"
#define Xorriso_timestamP "2015.11.06.123344"