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

This commit is contained in:
Thomas Schmitt 2015-11-06 12:57:36 +00:00
parent 6eacb2d7df
commit 90b80fdb6c
2 changed files with 9 additions and 17 deletions

View File

@ -364,14 +364,10 @@ int Xorriso_show_dux_subs(struct XorrisO *xorriso,
namept= name;
*size= 0;
sfe= malloc(5*SfileadrL);
path= malloc(SfileadrL);
show_path= malloc(SfileadrL);
name= malloc(SfileadrL);
if(path==NULL || show_path==NULL || name==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);
Xorriso_alloc_meM(name, char, SfileadrL);
if(lstat(abs_path, &stbuf)==-1)
{ret= 2; goto ex;}
@ -578,14 +574,10 @@ revoke_sorting:;
ret= 1;
ex:;
if(sfe!=NULL)
free(sfe);
if(path!=NULL)
free(path);
if(show_path!=NULL)
free(show_path);
if(name!=NULL)
free(name);
Xorriso_free_meM(sfe);
Xorriso_free_meM(path);
Xorriso_free_meM(show_path);
Xorriso_free_meM(name);
Linkitem_reset_stack(&own_link_stack, link_stack, 0);
Dirseq_destroy(&dirseq, 0);
if(filev!=NULL) {

View File

@ -1 +1 @@
#define Xorriso_timestamP "2015.11.06.125101"
#define Xorriso_timestamP "2015.11.06.125705"