Commit 809c130cef007055b19c12ab7fba3ce79ab56800
1 parent
f21c0ed9
Revert changes to fmopl.c
fmopl.c was taken from MAME and doesn't include QEMU header files so we cannot use qemu_malloc in it. It happens to build because C is a silly language. Unfortunately, it doesn't play nicely with the QEMU headers so lets just revert the changes that were made to it. Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6541 c046a42c-6fe2-441c-8c8c-71466251a162
Showing
1 changed file
with
22 additions
and
5 deletions
hw/fmopl.c
... | ... | @@ -619,10 +619,26 @@ static int OPLOpenTable( void ) |
619 | 619 | double pom; |
620 | 620 | |
621 | 621 | /* allocate dynamic tables */ |
622 | - TL_TABLE = qemu_malloc(TL_MAX*2*sizeof(INT32)); | |
623 | - SIN_TABLE = qemu_malloc(SIN_ENT*4 *sizeof(INT32 *)); | |
624 | - AMS_TABLE = qemu_malloc(AMS_ENT*2 *sizeof(INT32)); | |
625 | - VIB_TABLE = qemu_malloc(VIB_ENT*2 *sizeof(INT32)); | |
622 | + if( (TL_TABLE = malloc(TL_MAX*2*sizeof(INT32))) == NULL) | |
623 | + return 0; | |
624 | + if( (SIN_TABLE = malloc(SIN_ENT*4 *sizeof(INT32 *))) == NULL) | |
625 | + { | |
626 | + free(TL_TABLE); | |
627 | + return 0; | |
628 | + } | |
629 | + if( (AMS_TABLE = malloc(AMS_ENT*2 *sizeof(INT32))) == NULL) | |
630 | + { | |
631 | + free(TL_TABLE); | |
632 | + free(SIN_TABLE); | |
633 | + return 0; | |
634 | + } | |
635 | + if( (VIB_TABLE = malloc(VIB_ENT*2 *sizeof(INT32))) == NULL) | |
636 | + { | |
637 | + free(TL_TABLE); | |
638 | + free(SIN_TABLE); | |
639 | + free(AMS_TABLE); | |
640 | + return 0; | |
641 | + } | |
626 | 642 | /* make total level table */ |
627 | 643 | for (t = 0;t < EG_ENT-1 ;t++){ |
628 | 644 | rate = ((1<<TL_BITS)-1)/pow(10,EG_STEP*t/20); /* dB -> voltage */ |
... | ... | @@ -1205,7 +1221,8 @@ FM_OPL *OPLCreate(int type, int clock, int rate) |
1205 | 1221 | if(type&OPL_TYPE_ADPCM) state_size+= sizeof(YM_DELTAT); |
1206 | 1222 | #endif |
1207 | 1223 | /* allocate memory block */ |
1208 | - ptr = qemu_malloc(state_size); | |
1224 | + ptr = malloc(state_size); | |
1225 | + if(ptr==NULL) return NULL; | |
1209 | 1226 | /* clear */ |
1210 | 1227 | memset(ptr,0,state_size); |
1211 | 1228 | OPL = (FM_OPL *)ptr; ptr+=sizeof(FM_OPL); | ... | ... |