Skip to content

Commit

Permalink
Fix double free in case of PCM sample load error
Browse files Browse the repository at this point in the history
This hard to spot bug was caught in Lionel Debroux's honggfuzz tests.
Kudos to him!

Signed-off-by: Claudio Matsuoka <cmatsuoka@gmail.com>
  • Loading branch information
cmatsuoka committed Nov 20, 2016
1 parent 0935751 commit bd1eb5c
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions src/loaders/sample.c
Original file line number Diff line number Diff line change
Expand Up @@ -410,6 +410,7 @@ int libxmp_load_sample(struct module_data *m, HIO_HANDLE *f, int flags, struct x
#ifndef LIBXMP_CORE_PLAYER
err2:
free(xxs->data - 4);
xxs->data = NULL; /* prevent double free in PCM load error */
#endif
err:
return -1;
Expand Down

0 comments on commit bd1eb5c

Please sign in to comment.