orccodemem: Fix use-after-free in error paths
In file included from gstreamer/subprojects/orc/orc/orc.h:7,
from gstreamer/subprojects/orc/orc/orcprogram.h:5,
from gstreamer/subprojects/orc/orc/orccodemem.c:30:
gstreamer/subprojects/orc/orc/orccodemem.c: In function ‘orc_code_region_allocate_codemem_dual_map.constprop’:
gstreamer/subprojects/orc/orc/orcdebug.h:138:3: warning: pointer ‘filename’ may be used after ‘free’ [-Wuse-after-free]
138 | orc_debug_print((level), __FILE__, ORC_FUNCTION, __LINE__, __VA_ARGS__); \
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
gstreamer/subprojects/orc/orc/orcdebug.h:92:26: note: in expansion of macro ‘ORC_DEBUG_PRINT’
92 | #define ORC_WARNING(...) ORC_DEBUG_PRINT(ORC_DEBUG_WARNING, __VA_ARGS__)
| ^~~~~~~~~~~~~~~
gstreamer/subprojects/orc/orc/orccodemem.c:252:5: note: in expansion of macro ‘ORC_WARNING’
252 | ORC_WARNING ("failed to create write map '%s'. err=%i", filename, errno);
| ^~~~~~~~~~~
gstreamer/subprojects/orc/orc/orccodemem.c:234:3: note: call to ‘free’ here
234 | free (filename);
| ^~~~~~~~~~~~~~~
gstreamer/subprojects/orc/orc/orcdebug.h:138:3: warning: pointer ‘filename’ may be used after ‘free’ [-Wuse-after-free]
138 | orc_debug_print((level), __FILE__, ORC_FUNCTION, __LINE__, __VA_ARGS__); \
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
gstreamer/subprojects/orc/orc/orcdebug.h:92:26: note: in expansion of macro ‘ORC_DEBUG_PRINT’
92 | #define ORC_WARNING(...) ORC_DEBUG_PRINT(ORC_DEBUG_WARNING, __VA_ARGS__)
| ^~~~~~~~~~~~~~~
gstreamer/subprojects/orc/orc/orccodemem.c:245:5: note: in expansion of macro ‘ORC_WARNING’
245 | ORC_WARNING("failed to create exec map '%s'. err=%i", filename, errno);
| ^~~~~~~~~~~
gstreamer/subprojects/orc/orc/orccodemem.c:234:3: note: call to ‘free’ here
234 | free (filename);
| ^~~~~~~~~~~~~~~
Fixes:
bb5fcb31 ("orccodemem: Report errno during failures to create mmap codemap.")