Skip to content

Conversation

@trufae
Copy link
Collaborator

@trufae trufae commented Nov 24, 2025

  • Mark this if you consider it ready to merge
  • I've added tests (optional)
  • I wrote some lines in the book (optional)

Description

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@trufae trufae requested a review from Copilot November 24, 2025 21:20
Copilot finished reviewing on behalf of trufae November 24, 2025 21:23
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This pull request fixes memory leaks across various components of radare2 by adding missing free() calls, improving error handling paths, and adding null pointer checks.

Key Changes:

  • Added memory cleanup in error paths where allocated structures were not being freed before returning
  • Added null pointer validation checks using R_RETURN_IF_FAIL and R_RETURN_VAL_IF_FAIL macros in utility functions
  • Fixed variable initialization and realloc failure handling to prevent leaks

Reviewed changes

Copilot reviewed 19 out of 25 changed files in this pull request and generated no comments.

Show a summary per file
File Description
shlr/winkd/winkd.c Added free(mod) in error paths when length is zero or allocation fails for module listing
shlr/java/class.c Added r_bin_java_fmtype_free(method) when attribute parsing fails
libr/util/str.c Added free(str) before returning NULL on realloc failure
libr/util/print.c Added null pointer checks for RPrint parameter in multiple functions
libr/util/charset.c Added free(res) when buffer length check fails
libr/util/asn1.c Added missing free(object) and r_asn1_free(a) in error paths
libr/socket/socket_http_server.c Added free(hr) after closing HTTP request resources
libr/main/radare2.c Added missing free(bindir) and free(mandir) in cleanup code
libr/io/io_cache.c Added null check for incoming_ci->tree_itv and _io_cache_item_free(_ci) calls on realloc failures
libr/flag/flag.c Added free(itemname) before returning on invalid flag name
libr/debug/p/native/linux/linux_debug.c Added r_debug_pid_free(pid_info) when pid_info is not added to list
libr/core/vslides.c Set o = NULL after freeing to prevent double-free, reordered free operations
libr/core/cmd.c Added free(host) and free(k) in error paths
libr/bin/p/bin_dyldcache.c Added free(deps) when image reading fails
libr/bin/mangling/objc.c Removed redundant conditional checks and added free(name) before reassignment
libr/bin/mangling/cxx/cp-demangle.c Cached template check result in variable to avoid redundant evaluations
libr/bin/format/objc/mach0_classes.c Removed null checks for R_NEW0 allocations (potential issue), added field cleanup in error paths
libr/bin/format/mach0/mach0.c Fixed bug where wrong variable was used for symbol name, added free(symbol.name)
libr/bin/format/elf/elf.c Added free(isym) when import limit is reached
libr/asm/parse.c Added free(opstr) before returning result
libr/arch/p/x86_nz/pseudo.c Fixed variable declaration scope for hcmd, added free(buf) in early return
libr/arch/p/cosmac/pseudo.c Added free(buf) before returning in conditional branch
libr/arch/p/arm/armass64.c Fixed variable name from token to t, added free(t) in multiple error paths
libr/anal/sign.c Added memset initialization for combined_mask when a->bytes->mask is NULL
libr/anal/dwarf_process.c Added cleanup of visited set, free(name) before reassignment, conditional free for result->name, and initialized cas struct

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review for a chance to win a $100 gift card. Take the survey.

@trufae trufae merged commit 8c60845 into master Nov 24, 2025
52 checks passed
@trufae trufae deleted the fxes branch November 25, 2025 04:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants