Changeset - r5593:14e2ddedbdbe
[Not reviewed]
master
0 2 0
Darkvater - 17 years ago 2007-01-10 21:44:59
darkvater@openttd.org
(svn r8044) Regression (r8038): Crash on allocating bridge memory (peter1138)
2 files changed with 2 insertions and 2 deletions:
0 comments (0 inline, 0 general)
src/heightmap.cpp
Show inline comments
 
@@ -240,25 +240,25 @@ static bool ReadHeightmapBMP(char *filen
 
		BmpDestroyData(&data);
 
		return false;
 
	}
 

	
 
	if (map != NULL) {
 
		if (!BmpReadBitmap(&buffer, &info, &data)) {
 
			ShowErrorMessage(STR_BMPMAP_ERR_IMAGE_TYPE, STR_BMPMAP_ERROR, 0, 0);
 
			fclose(f);
 
			BmpDestroyData(&data);
 
			return false;
 
		}
 

	
 
		MallocT(map, info.width * info.height);
 
		MallocT(/* NO & */map, info.width * info.height);
 
		if (*map == NULL) {
 
			ShowErrorMessage(STR_PNGMAP_ERR_MISC, STR_BMPMAP_ERROR, 0, 0);
 
			fclose(f);
 
			BmpDestroyData(&data);
 
			return false;
 
		}
 

	
 
		ReadHeightmapBMPImageData(*map, &info, &data);
 

	
 
	}
 

	
 
	BmpDestroyData(&data);
src/newgrf.cpp
Show inline comments
 
@@ -1067,25 +1067,25 @@ static bool BridgeChangeInfo(uint brid, 
 
		case 0x0C: /* Maximum speed */
 
			FOR_EACH_OBJECT _bridge[brid + i].speed = grf_load_word(&buf);
 
			break;
 

	
 
		case 0x0D: /* Bridge sprite tables */
 
			FOR_EACH_OBJECT {
 
				Bridge *bridge = &_bridge[brid + i];
 
				byte tableid = grf_load_byte(&buf);
 
				byte numtables = grf_load_byte(&buf);
 

	
 
				if (bridge->sprite_table == NULL) {
 
					/* Allocate memory for sprite table pointers and zero out */
 
					CallocT(bridge->sprite_table, 7);
 
					CallocT(&bridge->sprite_table, 7);
 
				}
 

	
 
				for (; numtables-- != 0; tableid++) {
 
					byte sprite;
 

	
 
					if (tableid >= 7) { // skip invalid data
 
						grfmsg(1, "BridgeChangeInfo: Table %d >= 7, skipping", tableid);
 
						for (sprite = 0; sprite < 32; sprite++) grf_load_dword(&buf);
 
						continue;
 
					}
 

	
 
					if (bridge->sprite_table[tableid] == NULL) {
0 comments (0 inline, 0 general)