diff options
author | cinap_lenrek <cinap_lenrek@gmx.de> | 2012-07-31 09:43:24 +0200 |
---|---|---|
committer | cinap_lenrek <cinap_lenrek@gmx.de> | 2012-07-31 09:43:24 +0200 |
commit | 02acb1d4f00648b3ececd8fee2dc065f868e432e (patch) | |
tree | 43cfc9e8c944c75d2d6223551cbbb2bfa91cb5fa /sys/src/cmd/mothra/rdhtml.c | |
parent | a5d30a3d043c099bec912134c53c8d47a0ff7850 (diff) |
mothra: make emalloc zero memory, fix uninitialized nextline pointer crash
Diffstat (limited to 'sys/src/cmd/mothra/rdhtml.c')
-rw-r--r-- | sys/src/cmd/mothra/rdhtml.c | 24 |
1 files changed, 11 insertions, 13 deletions
diff --git a/sys/src/cmd/mothra/rdhtml.c b/sys/src/cmd/mothra/rdhtml.c index 0f0c90f1f..7bcf7367b 100644 --- a/sys/src/cmd/mothra/rdhtml.c +++ b/sys/src/cmd/mothra/rdhtml.c @@ -117,19 +117,17 @@ void pl_htmloutput(Hglob *g, int nsp, char *s, Field *field){ if(g->state->image[0]==0 && g->state->link[0]==0 && g->state->name[0]==0 && field==0) ap=0; else{ - ap=mallocz(sizeof(Action), 1); - if(ap!=0){ - if(g->state->image[0]) - ap->image = strdup(g->state->image); - if(g->state->link[0]) - ap->link = strdup(g->state->link); - if(g->state->name[0]) - ap->name = strdup(g->state->name); - ap->ismap=g->state->ismap; - ap->width=g->state->width; - ap->height=g->state->height; - ap->field=field; - } + ap=emalloc(sizeof(Action)); + if(g->state->image[0]) + ap->image = strdup(g->state->image); + if(g->state->link[0]) + ap->link = strdup(g->state->link); + if(g->state->name[0]) + ap->name = strdup(g->state->name); + ap->ismap=g->state->ismap; + ap->width=g->state->width; + ap->height=g->state->height; + ap->field=field; } if(space<0) space=0; if(indent<0) indent=0; |