rx: Avoid leaking 'sq' in libafs rx_GetCall 15/13715/4
authorAndrew Deason <adeason@dson.org>
Mon, 22 Jul 2019 02:15:11 +0000 (21:15 -0500)
committerBenjamin Kaduk <kaduk@mit.edu>
Wed, 28 Aug 2019 06:40:23 +0000 (02:40 -0400)
commit2df2de06e5df64f5666316b14d67de7e7c5dae70
tree7a00e72c802ec7768c4cd95e664a4bd008c63fb6
parent9eeb3ec09f5421ceab2be415a193bb3a3c44925f
rx: Avoid leaking 'sq' in libafs rx_GetCall

Currently, in rx_GetCall when building for the kernel, if we notice
that we're shutting down (that is, if afs_termState has reached
AFSOP_STOP_RXCALLBACK), we return immediately. However, 'sq' may have
been allocated much earlier in this function, and if we return here,
we never free 'sq' or set it on any list.

Returning immediately is also unnecessary here; if we just 'break' out
of our wait loop, 'call' will still be NULL, and we'll break out of
the outer loop, and go through the rest of the function like normal.
The only difference is, if we 'break' instead of 'return'ing, we'll
put 'sq' on the free list before returning.

So, just 'break' out of the loop instead of returning, so we put 'sq'
on the free list and avoid leaking its memory.

Change-Id: Ibb2f4e697a586392f76ccdbbefdae8d75740f6fe
Reviewed-on: https://gerrit.openafs.org/13715
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Tested-by: Benjamin Kaduk <kaduk@mit.edu>
src/rx/rx.c