]> git.tuebingen.mpg.de Git - paraslash.git/commit
mp4: Check return value of membuffer_transfer_from_file().
authorAndre Noll <maan@tuebingen.mpg.de>
Sat, 14 Aug 2021 20:27:12 +0000 (22:27 +0200)
committerAndre Noll <maan@tuebingen.mpg.de>
Mon, 30 May 2022 19:37:35 +0000 (21:37 +0200)
commit7f29c8effd9e1e534176d453b37e507e0600d7e7
treeda0e911e5c3981d5d0b42b300b010fe37c9eb393
parenta8c015f72b358b5f31f35408da8d0983c864aa25
mp4: Check return value of membuffer_transfer_from_file().

This function calls the ->read() method of the callback, which may
fail. Currently all three callers ignore the return value and rely
on the fact that the membuffer is set to error state, which will be
detected later.

It's easier and clearer to check for errors in the callers and fail
early on read errors. Since the membuffer is useless in the error
case, free it right away in membuffer_transfer_from_file(). Change
the function to return bool instead of unsigned while at it and remove
a pointless cast in one of its callers.
mp4.c