creachadair / imath

Arbitrary precision integer and rational arithmetic library
Other
129 stars 20 forks source link

Xcode static analyzer signals a memory leak issue #4

Closed jeroenleenarts closed 5 years ago

jeroenleenarts commented 10 years ago

When running static analysis on Xcode 5.1.1 I get a message that a memory issue might exist on the following line: https://github.com/creachadair/imath/blob/4d707e5ef22923ec230b8d5ed8c5879af8b62f03/imath.c#L449

Is this a real issue or is it safe to ignore?

creachadair commented 10 years ago

On Wed, Apr 30, 2014 at 2:29 AM, Jeroen Leenarts notifications@github.comwrote:

When running static analysis on Xcode 5.1.1 I get a message that a memory issue might exist on the following line: https://github.com/creachadair/imath/blob/4d707e5ef22923ec230b8d5ed8c5879af8b62f03/imath.c#L449

Is this a real issue or is it safe to ignore?

Does the message say anything about the nature of the issue? I'm not aware of any problems, but I'm loath to let a diagnostic like that pass without at least checking.

–M

jeroenleenarts commented 10 years ago

It seems to be that when mp_int_div is called with values not containing either a quotient or a remainder, there might be a memory issue. (As in, thequatient and/or remainder is allocated, and then forgotten while doing a realloc.

I think a little test might prove something.

creachadair commented 5 years ago

I never did manage to convince Xcode to reproduce this, and enough time has passed that the versions of everything are all different now. For what it's worth I wasn't able to trigger any warnings on this code with valgrind.

If you do see it pop up again, please let me know; sorry I let it languish so long.