NetworkBlockDevice / nbd

Network Block Device
GNU General Public License v2.0
459 stars 119 forks source link

Fix server array reference counting. #142

Closed juhaerk closed 1 year ago

juhaerk commented 1 year ago

The function given to g_array_set_clear_func() for clearing server arrays gets a pointer to server pointer as a parameter instead of simply pointer to server structure. This change adds a wrapper function removing one level of indirection. Before this change, when arrays are freed, the serve_dec_ref() would decrement random stuff in memory and rarely call free() to some random memory address, crashing nbd-server.