zero structure size, not pointer

This commit is contained in:
Charles Forsyth 2015-10-04 21:22:17 +01:00
parent 3d881635bd
commit d001a573f3
1 changed files with 5 additions and 5 deletions

View File

@ -317,10 +317,10 @@ p9anyinit(void)
passtokey(authkey, f[0]); passtokey(authkey, f[0]);
authid = strdup(f[1]); authid = strdup(f[1]);
authdom = strdup(f[2]); authdom = strdup(f[2]);
haveprotosmsg = malloc(strlen("p9sk1") + 1 + strlen(authdom) + 1); haveprotosmsg = smprint("p9sk1@%s", authdom);
sprint(haveprotosmsg, "p9sk1@%s", authdom); needprotomsg = smprint("p9sk1 %s", authdom);
needprotomsg = malloc(strlen("p9sk1") + 1 + strlen(authdom) + 1); if(haveprotosmsg == nil || needprotomsg == nil)
sprint(needprotomsg, "p9sk1 %s", authdom); sysfatal("out of memory");
} }
typedef struct AuthSession { typedef struct AuthSession {
@ -525,7 +525,7 @@ p9anyclunk(Fcall *rx, Fcall *tx)
fprint(2, "p9anyclunk: afid %d\n", rx->fid); fprint(2, "p9anyclunk: afid %d\n", rx->fid);
safefree(sp->uname); safefree(sp->uname);
safefree(sp->aname); safefree(sp->aname);
memset(sp, 0, sizeof(sp)); memset(sp, 0, sizeof(*sp));
free(sp); free(sp);
return nil; return nil;
} }