Refine r264422: set buf to NULL only when we don't allocate memory,
and free buf unconditionally. Requested by: kib MFC after: 1 week
This commit is contained in:
parent
9ba0aa30f1
commit
e3e2951f67
@ -1740,16 +1740,16 @@ __elfN(note_threadmd)(void *arg, struct sbuf *sb, size_t *sizep)
|
||||
|
||||
td = (struct thread *)arg;
|
||||
size = *sizep;
|
||||
buf = NULL;
|
||||
if (size != 0 && sb != NULL)
|
||||
buf = malloc(size, M_TEMP, M_ZERO | M_WAITOK);
|
||||
else
|
||||
buf = NULL;
|
||||
size = 0;
|
||||
__elfN(dump_thread)(td, buf, &size);
|
||||
KASSERT(*sizep == size, ("invalid size"));
|
||||
if (size != 0 && sb != NULL) {
|
||||
if (size != 0 && sb != NULL)
|
||||
sbuf_bcat(sb, buf, size);
|
||||
free(buf, M_TEMP);
|
||||
}
|
||||
free(buf, M_TEMP);
|
||||
*sizep = size;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user