diff options
author | tomsmeding <tom.smeding@gmail.com> | 2016-08-14 17:11:42 +0200 |
---|---|---|
committer | tomsmeding <tom.smeding@gmail.com> | 2016-08-14 17:11:42 +0200 |
commit | 472ee416b960eed639ca4f5bba6d250180eed3f0 (patch) | |
tree | 20fc1c631c441c8a3ce2deb971357dcdce7679f3 | |
parent | a7d52eef038d25b83ab7d7e8730749d877b6a73c (diff) |
Fix segfault after ^
-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; |