Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[2.1.0] pointer ‘peaks0’ may be used after ‘realloc’ [-Wuse-after-free] #4139

Closed
picca opened this issue Jun 16, 2024 · 1 comment · Fixed by #4147
Closed

[2.1.0] pointer ‘peaks0’ may be used after ‘realloc’ [-Wuse-after-free] #4139

picca opened this issue Jun 16, 2024 · 1 comment · Fixed by #4147
Milestone

Comments

@picca
Copy link
Contributor

picca commented Jun 16, 2024

Hello, while preparing the Debina package of 2.1.0, I got this warning about realloc

src/silx/math/fit/peaks/src/peaks.c: In function ‘seek’:
src/silx/math/fit/peaks/src/peaks.c:210:36: warning: pointer ‘peaks0’ may be used after ‘realloc’ [-Wuse-after-free]
  210 |                             *peaks = peaks0;
      |                             ~~~~~~~^~~~~~~~
src/silx/math/fit/peaks/src/peaks.c:206:41: note: call to ‘realloc’ here
  206 |                         realloc_peaks = realloc(peaks0, max_npeaks * sizeof(double));
      |                                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/silx/math/fit/peaks/src/peaks.c:211:41: warning: pointer ‘relevances0’ may be used after ‘realloc’ [-Wuse-after-free]
  211 |                             *relevances = relevances0;
      |                             ~~~~~~~~~~~~^~~~~~~~~~~~~
src/silx/math/fit/peaks/src/peaks.c:207:46: note: call to ‘realloc’ here
  207 |                         realloc_relevances = realloc(relevances0, max_npeaks * sizeof(double));
      |                                              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Cheers

Fred

@t20100
Copy link
Member

t20100 commented Jul 8, 2024

Thanks for the report!

Which version of gcc was used? 14?

PR #4147 might fix this. Is there an easy to set-up environment where I could test this?

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 a pull request may close this issue.

2 participants