[Kstars-devel] Suspicious code in KStars

Akarsh Simha akarshsimha at gmail.com
Wed Oct 15 18:09:39 CEST 2008


Hi

I have touched only these issues, because these are the bits of code I
understand more easily. Will look at the others sometime later.

> - kdeedu/kstars/kstars/skycomponents/starcomponent.cpp:144
> 
> Add a todo comment to not forget this issue.

Err, I made a commit that changed the line numbers, so I couldn't
figure out which issue.

> - kdeedu/kstars/kstars/skycomponents/constellationboundarylines.cpp:129
> 
> If line 106 is not visited then polyList is NULL here.

Fixed, hopefully, by a Q_ASSERT( polyList );

> - kdeedu/kstars/kstars/skycomponents/starblock.cpp:78
> 
> plainStarTemplate is a pointer. Therefore &plainStarTemplate is a pointer to 
> a
> pointer. The memory pointed at is only sizeof(void*) bytes long. Not
> sizeof(StarObject).

Fixed. Wonder why this wasn't giving any trouble. Probably it's just
that the particular method is never called.

> - kdeedu/kstars/kstars/kswizard.cpp:164
> 
> If line 155 is false then Geo is NULL here.

Fixed. I tried to produce a crash, but the code never leads to such a
situation. Of course, it's dangerous code and should be fixed. I moved
the functions that set Geo inside the if condition. Now is there a
memory leak there?

> - kdeedu/kstars/kstars/starobject.cpp:209-213
> 
> = instead of == here?

Those should be '='s. I used the Perl-like constructs because they
somehow felt more intuitive and readable to me.

> - kdeedu/kstars/kstars/binfilehelper.cpp:120
> 
> Leaking the pointer from line 118 here.

Fixed with a delete de;

Thanks a lot for pointing them out.

Regards
Akarsh
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: Digital signature
Url : http://mail.kde.org/pipermail/kstars-devel/attachments/20081015/cc5d947d/attachment.sig 


More information about the Kstars-devel mailing list