[Kstars-devel] KDE/kdeedu/kstars/kstars/skyobjects

Alexey Khudyakov alexey.skladnoy at gmail.com
Tue Jul 28 18:21:26 CEST 2009


SVN commit 1003687 by khudyakov:

Fix memory leak in SkyPoints::vREarth.
KSNumbers was allocated but never deleted.

CCMAIL: kstars-devel at kde.org



 M  +5 -9      skypoint.cpp  


--- trunk/KDE/kdeedu/kstars/kstars/skyobjects/skypoint.cpp #1003686:1003687
@@ -667,9 +667,8 @@
 
 double SkyPoint::vREarth(long double jd0)
 {
+    double sinRA, sinDec, cosRA, cosDec;
 
-    double sinRA, sinDec, cosRA, cosDec, vREarth;
-
     /* u_radial = unitary vector in the direction of the source
     	Vlsr 	= Vhel + Vsun.u_radial
     		= Vgeo + VEarth.u_radial + Vsun.u_radial  =>
@@ -696,13 +695,10 @@
     the source coordinates are also in the same reference system.
     */
 
-    KSNumbers *num = new KSNumbers(jd0);
-
-    vREarth = num->vEarth(0) * cosDec * cosRA +
-              num->vEarth(1) * cosDec * sinRA +
-              num->vEarth(2) * sinDec;
-
-    return vREarth;
+    KSNumbers num(jd0);
+    return num.vEarth(0) * cosDec * cosRA +
+           num.vEarth(1) * cosDec * sinRA +
+           num.vEarth(2) * sinDec;
 }
 
 


More information about the Kstars-devel mailing list