Revision 1eec614b console.c
b/console.c | ||
---|---|---|
1246 | 1246 |
if (nb_consoles >= MAX_CONSOLES) |
1247 | 1247 |
return NULL; |
1248 | 1248 |
s = qemu_mallocz(sizeof(TextConsole)); |
1249 |
if (!s) { |
|
1250 |
return NULL; |
|
1251 |
} |
|
1252 | 1249 |
if (!active_console || ((active_console->console_type != GRAPHIC_CONSOLE) && |
1253 | 1250 |
(console_type == GRAPHIC_CONSOLE))) { |
1254 | 1251 |
active_console = s; |
... | ... | |
1280 | 1277 |
DisplayState *ds; |
1281 | 1278 |
|
1282 | 1279 |
ds = (DisplayState *) qemu_mallocz(sizeof(DisplayState)); |
1283 |
if (ds == NULL) |
|
1284 |
return NULL; |
|
1285 | 1280 |
ds->surface = qemu_create_displaysurface(640, 480, 32, 640 * 4); |
1286 | 1281 |
|
1287 | 1282 |
s = new_console(ds, GRAPHIC_CONSOLE); |
... | ... | |
1402 | 1397 |
CharDriverState *chr; |
1403 | 1398 |
|
1404 | 1399 |
chr = qemu_mallocz(sizeof(CharDriverState)); |
1405 |
if (!chr) |
|
1406 |
return NULL; |
|
1407 | 1400 |
|
1408 | 1401 |
if (n_text_consoles == 128) { |
1409 | 1402 |
fprintf(stderr, "Too many text consoles\n"); |
... | ... | |
1562 | 1555 |
DisplaySurface* qemu_create_displaysurface(int width, int height, int bpp, int linesize) |
1563 | 1556 |
{ |
1564 | 1557 |
DisplaySurface *surface = (DisplaySurface*) qemu_mallocz(sizeof(DisplaySurface)); |
1565 |
if (surface == NULL) { |
|
1566 |
fprintf(stderr, "qemu_create_displaysurface: malloc failed\n"); |
|
1567 |
exit(1); |
|
1568 |
} |
|
1569 | 1558 |
|
1570 | 1559 |
surface->width = width; |
1571 | 1560 |
surface->height = height; |
... | ... | |
1577 | 1566 |
surface->flags = QEMU_ALLOCATED_FLAG; |
1578 | 1567 |
#endif |
1579 | 1568 |
surface->data = (uint8_t*) qemu_mallocz(surface->linesize * surface->height); |
1580 |
if (surface->data == NULL) { |
|
1581 |
fprintf(stderr, "qemu_create_displaysurface: malloc failed\n"); |
|
1582 |
exit(1); |
|
1583 |
} |
|
1584 | 1569 |
|
1585 | 1570 |
return surface; |
1586 | 1571 |
} |
... | ... | |
1596 | 1581 |
surface->data = (uint8_t*) qemu_realloc(surface->data, surface->linesize * surface->height); |
1597 | 1582 |
else |
1598 | 1583 |
surface->data = (uint8_t*) qemu_malloc(surface->linesize * surface->height); |
1599 |
if (surface->data == NULL) { |
|
1600 |
fprintf(stderr, "qemu_resize_displaysurface: malloc failed\n"); |
|
1601 |
exit(1); |
|
1602 |
} |
|
1603 | 1584 |
#ifdef WORDS_BIGENDIAN |
1604 | 1585 |
surface->flags = QEMU_ALLOCATED_FLAG | QEMU_BIG_ENDIAN_FLAG; |
1605 | 1586 |
#else |
... | ... | |
1613 | 1594 |
int linesize, uint8_t *data) |
1614 | 1595 |
{ |
1615 | 1596 |
DisplaySurface *surface = (DisplaySurface*) qemu_mallocz(sizeof(DisplaySurface)); |
1616 |
if (surface == NULL) { |
|
1617 |
fprintf(stderr, "qemu_create_displaysurface_from: malloc failed\n"); |
|
1618 |
exit(1); |
|
1619 |
} |
|
1620 | 1597 |
|
1621 | 1598 |
surface->width = width; |
1622 | 1599 |
surface->height = height; |
Also available in: Unified diff