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

fgwrite: memory allocation trouble #7

Closed
olebole opened this issue Aug 16, 2018 · 0 comments · Fixed by #8
Closed

fgwrite: memory allocation trouble #7

olebole opened this issue Aug 16, 2018 · 0 comments · Fixed by #8

Comments

@olebole
Copy link
Member

olebole commented Aug 16, 2018

The file fgwrite.c is obviously buggy in the memory allocation of slines. slines is globally defined:
https://github.com/iraf-community/fitsutil/blob/a85313c562dd446c2e75f1f8835f971f5354f740/src/fgwrite.c#L112

This mess goes completely to hell when a reallocation is necessary. Not only is realloc() called with the wrong arguments; sptable was also incremented before (so that it does not point anymore to the allocated memory). And after a realloc, the free(ip) will free the wrong memory.
Welcome to IRAF.

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.

1 participant