mirror of
				https://github.com/libsdl-org/SDL.git
				synced 2025-10-26 12:27:44 +00:00 
			
		
		
		
	fix GetNearbyFilename
- fix memory leak due to variable 'base' - fix usage of uninitialized variable (path)
This commit is contained in:
		| @@ -35,15 +35,18 @@ GetNearbyFilename(const char *file) | |||||||
|         path = SDL_malloc(len); |         path = SDL_malloc(len); | ||||||
|  |  | ||||||
|         if (path == NULL) { |         if (path == NULL) { | ||||||
|  |             SDL_free(base); | ||||||
|             SDL_OutOfMemory(); |             SDL_OutOfMemory(); | ||||||
|             return NULL; |             return NULL; | ||||||
|         } |         } | ||||||
|  |  | ||||||
|         SDL_snprintf(path, len, "%s%s%s", base, pathsep, file); |         SDL_snprintf(path, len, "%s%s%s", base, pathsep, file); | ||||||
|     } |  | ||||||
|  |  | ||||||
|     if (base) { |  | ||||||
|         SDL_free(base); |         SDL_free(base); | ||||||
|  |     } else { | ||||||
|  |         path = SDL_strdup(file); | ||||||
|  |         if (path == NULL) { | ||||||
|  |             SDL_OutOfMemory(); | ||||||
|  |         } | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     return path; |     return path; | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 pionere
					pionere