diff options
-rw-r--r-- | bfcomp.c | 8 |
1 files changed, 5 insertions, 3 deletions
@@ -327,9 +327,11 @@ void readsource(FILE *f,char **sourcep,Sourcemap **smp){ sz*=2; source=realloc(source,sz); if(!source)outofmem(); - sm->maps=realloc(sm->maps,sz*sizeof(Range)); - if(!sm->maps)outofmem(); - memset(sm->maps+sz/2,0,sz/2*sizeof(Range)); + if(sm){ + sm->maps=realloc(sm->maps,sz*sizeof(Range)); + if(!sm->maps)outofmem(); + memset(sm->maps+sz/2,0,sz/2*sizeof(Range)); + } } char c=fgetc(f); if(feof(f))break; |