Conversation
…oss multiple files Co-authored-by: matteius <479892+matteius@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix memory handling for g_config_dir in go2rtc_process
Fix memory safety, misleading error messages, logging correctness, and React hook bugs
Mar 6, 2026
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Applies a collection of targeted correctness fixes across the go2rtc process management, HLS thread, MP4/audio transcoding, ONVIF auth, and WebRTC UI layers.
go2rtc_process.c
g_config_dirafter free on malloc failure — prevents use-after-free if the function is called again after partial initopen()vsfdopen()failures — previously both printed the same string, making log triage ambiguousPATH_MAXinstead of1024forlog_path/log_dirstack buffers — 1024 is arbitrary and smaller thanPATH_MAX(4096) defined in the same filefprintf(stderr, ...)in child process post-fork()— calling the logging system beforeexec()in the child is unsafe due to shared file descriptorshls_unified_thread.c
is_stream_stopping(NULL)from theav_freepguard — passingNULLhas undefined behavior;is_shutdown_initiated()alone is the correct condition here2025-04-11was misleading (current date is 2026)mp4_writer_utils.c / mp4_writer_internal.h
transcode_mulaw_to_aac→transcode_pcm_to_aac— the function handles μ-law, A-law, S16LE, and other PCM variants; the old name misrepresented its scope. Updated definition, header declaration, and all call sites.onvif_device_management.c
passwordwas copied withpassword_len + 1(including null terminator); the spec requires raw bytes only:WebRTCView.jsx
selectedStream→setSelectedStreaminfinite loop — added early returnif (selectedStream) return;so the stream-processing effect never overrides an already-selected stream[streamsData, selectedStream]to[streamsData, autoGrid];autoGridwas read inside the effect but omitted from depsOriginal prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.