xfree86: loader: fix memory leaks in LoaderListDirs
Signed-off-by: Tiago Vignatti <tiago.vignatti@nokia.com> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Nicolas Peninguy <nico@lostgeeks.org> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
		
							parent
							
								
									9c4aae2141
								
							
						
					
					
						commit
						d044d36756
					
				|  | @ -532,6 +532,7 @@ LoaderListDirs(const char **subdirlist, const char **patternlist) | |||
| 				FreePathList(pathlist); | ||||
| 				FreeSubdirs(subdirs); | ||||
| 				FreePatterns(patterns); | ||||
| 				closedir(d); | ||||
| 				return NULL; | ||||
| 			    } | ||||
| 			    listing[n] = malloc(len + 1); | ||||
|  | @ -540,6 +541,7 @@ LoaderListDirs(const char **subdirlist, const char **patternlist) | |||
| 				FreePathList(pathlist); | ||||
| 				FreeSubdirs(subdirs); | ||||
| 				FreePatterns(patterns); | ||||
| 				closedir(d); | ||||
| 				return NULL; | ||||
| 			    } | ||||
| 			    strncpy(listing[n], dp->d_name + match[1].rm_so, | ||||
|  | @ -556,6 +558,10 @@ LoaderListDirs(const char **subdirlist, const char **patternlist) | |||
|     } | ||||
|     if (listing) | ||||
| 	listing[n] = NULL; | ||||
| 
 | ||||
|     FreePathList(pathlist); | ||||
|     FreeSubdirs(subdirs); | ||||
|     FreePatterns(patterns); | ||||
|     return listing; | ||||
| } | ||||
| 
 | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue