Re: [hatari-devel] Analyse

[ Thread Index | Date Index | More lists.tuxfamily.org/hatari-devel Archives ]


Am Tue, 22 Jul 2014 11:53:44 +0200
schrieb Cocoa Pod <cocoa.pod@xxxxxxx>:

> hi all,
> I don’t know who will be interested?
> I created Xcode project  to compile Hatari old CPU. I launched Xcode
> Analyze for Hatari. In some place I’ve this result:   Potential leak
> of memory pointed to by ….. Below the result file from Analyze

 Hi,

thanks for the log. There were indeed some spots in the code that leaked
memory in certain cases, and some others could be cleaned up a
little bit ...

> ~/hatari/src/debug/68kDisass.c
> ~/hatari/src/debug/68kDisass.c:636:2: Value stored to 'val' is never read

fixed.

> ~/hatari/src/falcon/crossbar.c
> ~/hatari/src/falcon/crossbar.c:2062:2: Function call argument is an uninitialized value

Not sure what should be wrong here? False alarm?

> ~/hatari/src/debug/debugui.c
> ~/hatari/src/debug/debugui.c:231:4: Potential leak of memory pointed to by 'input'
> ~/hatari/src/debug/debugui.c:779:2: Value stored to 'input' is never read
> ~/hatari/src/debug/debugui.c:1053:2: Value stored to 'psCmd' is never read

fixed.

> ~/hatari/src/gui-sdl/dlgAlert.c
> ~/hatari/src/gui-sdl/dlgAlert.c:144:4: String copy function overflows destination buffer

Not sure what could go wrong here... is this related to a special alert dialog text?

> ~/hatari/src/gui-sdl/dlgFileSelect.c
> ~/hatari/src/gui-sdl/dlgFileSelect.c:245:2: Value stored to 'b' is never read
> ~/hatari/src/gui-sdl/dlgFileSelect.c:683:6: Potential leak of memory pointed to by 'tempstr'

fixed.

> ~/hatari/src/uae-cpu/cpuemu.c
> ~/hatari/src/uae-cpu/cpuemu.c:2785:10: Value stored to 'srcreg' during its initialization is never read
[...]
> ~/hatari/src/uae-cpu/cpuemu.c Showing first 200 warnings only

I don't want to touch these warnings since cpuemu.c is generated code and this is not critical.

> ~/hatari/src/debug/evaluate.c
> ~/hatari/src/debug/evaluate.c:317:9: Function call argument is an uninitialized value

Should be false alarm, but I rearranged the code a little bit so that this should not happen anymore.

> ~/hatari/src/fdc.c
> ~/hatari/src/fdc.c:2020:4: Value stored to 'FdcCycles' is never read

Nicolas, is it ok that this value is dropped?

> ~/hatari/src/file.c
> ~/hatari/src/file.c:216:6: Potential leak of memory pointed to by 'filepath'
> ~/hatari/src/floppy.c
> ~/hatari/src/floppy.c:372:4: Potential leak of memory pointed to by 'filename'

fixed.

> ~/hatari/src/falcon/dsp_cpu.c
> ~/hatari/src/falcon/dsp_cpu.c:2328:35: Function call argument is an uninitialized value
[...]
> ~/hatari/src/falcon/dsp_cpu.c:4033:3: Function call argument is an uninitialized value

these warnings look like a false alarm to me.

> ~/hatari/src/memorySnapShot.c
> ~/hatari/src/memorySnapShot.c:396:2: Undefined or garbage value returned to caller
> ~/hatari/src/memorySnapShot.c:403:2: Undefined or garbage value returned to caller

Should be false alarm.

> ~/hatari/src/paths.c
> ~/hatari/src/paths.c:90:3: Potential leak of memory pointed to by 'pPathEnv'

fixed.

> ~/hatari/src/debug/profiledsp.c
> ~/hatari/src/debug/profiledsp.c:135:2: Value stored to 'show' is never read

fixed.

> ~/hatari/src/uae-cpu/readcpu.c
> ~/hatari/src/uae-cpu/readcpu.c:614:4: Value stored to 'pos' is never read
> ~/hatari/src/uae-cpu/readcpu.c:665:4: Value stored to 'pos' is never read
> ~/hatari/src/uae-cpu/readcpu.c:790:6: Value stored to 'smsk' is never read
> ~/hatari/src/uae-cpu/readcpu.c:790:16: Value stored to 'sbitdst' is never read
> ~/hatari/src/uae-cpu/readcpu.c:807:38: The result of the '<<' expression is undefined

Quite ugly UAE CPU core code ... too tired to touch that stuff now...

> ~/hatari/src/convert/low320x8.c
> ~/hatari/src/convert/low320x8.c:18:2: Value stored to 'edx' is never read
> ~/hatari/src/convert/low320x16_spec.c
> ~/hatari/src/convert/low320x16_spec.c:25:2: Value stored to 'edx' is never read
> ~/hatari/src/convert/low320x16_spec.c:31:3: Value stored to 'edx' is never read
> ~/hatari/src/convert/low640x16_spec.c
> ~/hatari/src/convert/low640x16_spec.c:48:2: Value stored to 'edx' is never read
> ~/hatari/src/convert/low320x32_spec.c
> ~/hatari/src/convert/low320x32_spec.c:25:2: Value stored to 'edx' is never read
> ~/hatari/src/convert/low320x32_spec.c:31:3: Value stored to 'edx' is never read
> ~/hatari/src/convert/low640x32_spec.c
> ~/hatari/src/convert/low640x32_spec.c:48:2: Value stored to 'edx' is never read
> ~/hatari/src/convert/vdi16.c
> ~/hatari/src/convert/vdi16.c:18:2: Value stored to 'edx' is never read

fixed.

> ~/hatari/src/statusbar.c
> ~/hatari/src/statusbar.c:339:2: Value stored to 'xoffset' is never read

fixed.

> ~/hatari/src/unzip.c
> ~/hatari/src/unzip.c:615:3: Value stored to 'lSeek' is never read
> ~/hatari/src/unzip.c:618:3: Value stored to 'lSeek' is never read
> ~/hatari/src/unzip.c:885:3: Value stored to 'err' is never read

At least that part about "err" looks like the code should maybe behave in
a different way there (e.g. return an error instead of continuing)...
somebody needs to look at this separately...

> ~/hatari/src/falcon/videl.c
> ~/hatari/src/falcon/videl.c:243:3: Value stored to 'addr_new' is never read
> ~/hatari/src/falcon/videl.c:245:3: Value stored to 'addr_new' is never read
> ~/hatari/src/falcon/videl.c:247:3: Value stored to 'addr_new' is never read

Looks like that function is simply incomplete yet ...
Laurent, could we simply comment out that code for now?

> ~/hatari/src/falcon/videl.c:1489:5: Value stored to 'fvram_line' is never read
> ~/hatari/src/falcon/videl.c:1604:12: Value stored to 'hvram_column' during its initialization is never read
> ~/hatari/src/falcon/videl.c:1656:7: Value stored to 'hvram_column' is never read
[...]

These videl convert functions are IMHO way too big and need a major refactoring one day... so I'd like to postpone this to that point in time.

~/hatari/src/zip.c
~/hatari/src/zip.c:317:4: Potential leak of memory pointed to by 'files'
~/hatari/src/zip.c:403:3: Potential leak of memory pointed to by 'files'
~/hatari/src/zip.c:433:10: Potential leak of memory pointed to by 'name'

Fixed.

~/hatari/src/zip.c:426:3: Function call argument is an uninitialized value

Not sure what's wrong here ... false alarm?

~/hatari/src/gui-osx/PrefsController.m
~/hatari/src/gui-osx/PrefsController.m:246:5: Value stored to 'directoryToOpen' is never read
~/hatari/src/gui-osx/PrefsController.m:247:3: Value stored to 'fileToPreselect' is never read
~/hatari/src/gui-osx/PrefsController.m:249:5: Value stored to 'directoryToOpen' is never read

I'll leave these to you or Jerome.

 Thomas



Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/