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); | 				FreePathList(pathlist); | ||||||
| 				FreeSubdirs(subdirs); | 				FreeSubdirs(subdirs); | ||||||
| 				FreePatterns(patterns); | 				FreePatterns(patterns); | ||||||
|  | 				closedir(d); | ||||||
| 				return NULL; | 				return NULL; | ||||||
| 			    } | 			    } | ||||||
| 			    listing[n] = malloc(len + 1); | 			    listing[n] = malloc(len + 1); | ||||||
|  | @ -540,6 +541,7 @@ LoaderListDirs(const char **subdirlist, const char **patternlist) | ||||||
| 				FreePathList(pathlist); | 				FreePathList(pathlist); | ||||||
| 				FreeSubdirs(subdirs); | 				FreeSubdirs(subdirs); | ||||||
| 				FreePatterns(patterns); | 				FreePatterns(patterns); | ||||||
|  | 				closedir(d); | ||||||
| 				return NULL; | 				return NULL; | ||||||
| 			    } | 			    } | ||||||
| 			    strncpy(listing[n], dp->d_name + match[1].rm_so, | 			    strncpy(listing[n], dp->d_name + match[1].rm_so, | ||||||
|  | @ -556,6 +558,10 @@ LoaderListDirs(const char **subdirlist, const char **patternlist) | ||||||
|     } |     } | ||||||
|     if (listing) |     if (listing) | ||||||
| 	listing[n] = NULL; | 	listing[n] = NULL; | ||||||
|  | 
 | ||||||
|  |     FreePathList(pathlist); | ||||||
|  |     FreeSubdirs(subdirs); | ||||||
|  |     FreePatterns(patterns); | ||||||
|     return listing; |     return listing; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue