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

View File

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