dk / Prima

prima.eu.org
Other
106 stars 27 forks source link

Fix a use-after free in destroy_ahead() #87

Closed ppisar closed 1 year ago

ppisar commented 1 year ago

GCC 13 warns:

In function 'destroy_ahead', inlined from 'load' at img/codec_bmp.c:875:10: img/codec_bmp.c:214:26: warning: pointer 'ahead_1042' used after 'free' [-Wuse-after-free] 214 | if (error & ahead-> fi-> wasTruncated) error = false; | ~^~~~~ img/codec_bmp.c:213:9: note: call to 'free' here 213 | free(ahead); | ^~~

This patch fixes it by swapping the two lines.