diff --git a/crypto777/iguana_OS.c b/crypto777/iguana_OS.c index e78716f2d..a4e58b932 100755 --- a/crypto777/iguana_OS.c +++ b/crypto777/iguana_OS.c @@ -406,6 +406,8 @@ int64_t iguana_memallocated(struct OS_memspace *mem) void *iguana_memalloc(struct OS_memspace *mem,long size,int32_t clearflag) { int32_t modval; void *ptr = 0; + if ( mem->ptr == 0 ) + return(0); //printf("iguana_memalloc.%s size.%ld used.%llu of %llu, numptrs.%d avail.%d %lld\n",mem->name,size,(long long)mem->used,(long long)mem->totalsize,mem->numptrs,mem->availptrs,(long long)iguana_memallocated(mem)); //if ( mem->threadsafe != 0 ) // portable_mutex_lock(&mem->mutex); diff --git a/iguana/iguana_ramchain.c b/iguana/iguana_ramchain.c index b57b5d8e8..5aa918a01 100755 --- a/iguana/iguana_ramchain.c +++ b/iguana/iguana_ramchain.c @@ -1297,10 +1297,9 @@ int32_t iguana_ramchain_extras(struct iguana_info *coin,struct iguana_ramchain * if ( (ramchain->hashmem= hashmem) != 0 ) iguana_memreset(hashmem); else printf("alloc ramchain->A %ld\n",sizeof(struct iguana_account) * ramchain->H.data->numpkinds); - ramchain->A = (hashmem != 0) ? iguana_memalloc(hashmem,sizeof(struct iguana_account) * ramchain->H.data->numpkinds,1) : mycalloc('p',ramchain->H.data->numpkinds,sizeof(struct iguana_account)); - ramchain->Uextras = (hashmem != 0) ? iguana_memalloc(hashmem,sizeof(*ramchain->Uextras) * ramchain->H.data->numunspents,1) : mycalloc('p',ramchain->H.data->numunspents,sizeof(*ramchain->Uextras)); - } - else err = iguana_volatilesmap(coin,ramchain); + ramchain->A = (hashmem != 0 && hashmem->ptr != 0) ? iguana_memalloc(hashmem,sizeof(struct iguana_account) * ramchain->H.data->numpkinds,1) : mycalloc('p',ramchain->H.data->numpkinds,sizeof(struct iguana_account)); + ramchain->Uextras = (hashmem != 0 && hashmem->ptr != 0) ? iguana_memalloc(hashmem,sizeof(*ramchain->Uextras) * ramchain->H.data->numunspents,1) : mycalloc('p',ramchain->H.data->numunspents,sizeof(*ramchain->Uextras)); + } else err = iguana_volatilesmap(coin,ramchain); } return(err); }