Last active
August 6, 2023 16:28
-
-
Save ss23/f9bc215012d1c2f31002ad5d93378d9d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void *oldbuf = view->buf; | |
view->buf = realloc(oldbuf, 1000); | |
if (view->buf == NULL) { | |
if (oldbuf != NULL) | |
free(oldbuf); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
../src/gui/image_display.c: In function 'allocate_full_surface':
../src/gui/image_display.c:92:25: error: pointer 'oldbuf' may be used after 'realloc' [-Werror=use-after-free]
92 | free(oldbuf);
| ^~~~~~~~~~~~
../src/gui/image_display.c:89:29: note: call to 'realloc' here
89 | view->buf = realloc(oldbuf, stride * gfit.ry * sizeof(guchar));
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~