]> git.rm.cloudns.org Git - xonotic/darkplaces.git/commitdiff
shut up some Valgrind use of uninitialized memory reports nyov/valgrind-memcheck
authornyov <nyov@nexnode.net>
Sat, 22 Nov 2014 05:44:03 +0000 (05:44 +0000)
committernyov <nyov@nexnode.net>
Sat, 22 Nov 2014 20:49:58 +0000 (20:49 +0000)
.valgrindrc [new file with mode: 0644]
lhnet.c
matrixlib.c
netconn.c
valgrind_dp.supp [new file with mode: 0644]
view.c

diff --git a/.valgrindrc b/.valgrindrc
new file mode 100644 (file)
index 0000000..9f77fc6
--- /dev/null
@@ -0,0 +1,2 @@
+# $ valgrind [valgrind opts] darkplaces [dp args]
+--suppressions=valgrind_dp.supp
diff --git a/lhnet.c b/lhnet.c
index e3bc6b712186f54dd511fd4165ddfc2f54fa3c88..132441c48bd16375426ceb63e9ab4978acf00f0e 100644 (file)
--- a/lhnet.c
+++ b/lhnet.c
@@ -156,7 +156,7 @@ int LHNETADDRESS_FromPort(lhnetaddress_t *vaddress, lhnetaddresstype_t addressty
 #ifdef SUPPORTIPV6
 static int LHNETADDRESS_Resolve(lhnetaddressnative_t *address, const char *name, int port)
 {
-       char port_buff [16];
+       char port_buff [16] = {0};
        struct addrinfo hints;
        struct addrinfo* addrinf;
        int err;
@@ -201,7 +201,7 @@ int LHNETADDRESS_FromString(lhnetaddress_t *vaddress, const char *string, int de
        int i, port, d1, d2, d3, d4, resolved;
        size_t namelen;
        unsigned char *a;
-       char name[128];
+       char name[128] = {0};
 #ifdef STANDALONETEST
        char string2[128];
 #endif
index 78c859cfed39673b9e6f7f6628ca8dae90c91e50..da46e3cd061b123269114a82c25b56490252f5ab 100644 (file)
@@ -717,6 +717,7 @@ void Matrix4x4_CreateScale3 (matrix4x4_t *out, double x, double y, double z)
 void Matrix4x4_CreateFromQuakeEntity(matrix4x4_t *out, double x, double y, double z, double pitch, double yaw, double roll, double scale)
 {
        double angle, sr, sp, sy, cr, cp, cy;
+       angle = sr = sp = sy = cr = cp = cy = 0; // valgrind
 
        if (roll)
        {
index 940bb1a71ac9768cd82298037b177ac29418bf20..11124143fd3fd0aa87f32790485788fbdc771b1e 100755 (executable)
--- a/netconn.c
+++ b/netconn.c
@@ -1705,7 +1705,7 @@ static void NetConn_ClientParsePacket_ServerList_ParseDPList(lhnetaddress_t *sen
                Con_Printf("received DarkPlaces %sserver list...\n", isextended ? "extended " : "");
        while (length >= 7)
        {
-               char ipstring [128];
+               char ipstring[128] = {0};
 
                // IPv4 address
                if (data[0] == '\\')
@@ -2324,15 +2324,15 @@ void NetConn_QueryQueueFrame(void)
                        continue;
                }
 
-               serverlist_querysleep   = false;
-               if( entry->querycounter !=      0 && entry->querytime > timeouttime     )
+               serverlist_querysleep = false;
+               if( entry->querycounter != 0 && entry->querytime > timeouttime )
                {
                        continue;
                }
 
-               if( entry->querycounter !=      (unsigned) net_slist_maxtries.integer )
+               if( entry->querycounter != (unsigned) net_slist_maxtries.integer )
                {
-                       lhnetaddress_t  address;
+                       lhnetaddress_t address = {0};
                        int socket;
 
                        LHNETADDRESS_FromString(&address, entry->info.cname, 0);
diff --git a/valgrind_dp.supp b/valgrind_dp.supp
new file mode 100644 (file)
index 0000000..b3bf0ea
--- /dev/null
@@ -0,0 +1,87 @@
+# valgrind error suppression file for darkplaces
+#
+# (please expand and generalize -- only where needed)
+# how to write these: http://valgrind.org/docs/manual/mc-manual.html#mc-manual.suppfiles
+
+# suppress (leak) errors in all shared libraries
+#{
+#   ignore_unversioned_libs_leak
+#   Memcheck:Leak
+#   ...
+#   obj:*/lib*/lib*.so
+#}
+#{
+#   ignore_versioned_libs_leak
+#   Memcheck:Leak
+#   ...
+#   obj:*/lib*/lib*.so.*
+#}
+
+# SDL
+# ignore calls to it (or not, there are only a few issues here)
+#{
+#   sdl_c
+#   Memcheck:Cond
+#   obj:/usr/lib/x86_64-linux-gnu/libSDL-1.2.so.0.11.4
+#   ...
+#}
+
+# fglrx. IGNORE them all...
+# (these read: "ignoring anything that called into or is called by this lib (callbacks")
+{
+   ignore_fglrx_dri_leak
+   Memcheck:Leak
+   ...
+   obj:/usr/lib/x86_64-linux-gnu/dri/fglrx_dri.so
+   ...
+}
+{
+   ignore_fglrx_dri_1
+   Memcheck:Addr1
+   ...
+   obj:/usr/lib/x86_64-linux-gnu/dri/fglrx_dri.so
+   ...
+}
+{
+   ignore_fglrx_dri_2
+   Memcheck:Addr2
+   ...
+   obj:/usr/lib/x86_64-linux-gnu/dri/fglrx_dri.so
+   ...
+}
+{
+   ignore_fglrx_dri_4
+   Memcheck:Addr4
+   ...
+   obj:/usr/lib/x86_64-linux-gnu/dri/fglrx_dri.so
+   ...
+}
+{
+   ignore_fglrx_dri_8
+   Memcheck:Addr8
+   ...
+   obj:/usr/lib/x86_64-linux-gnu/dri/fglrx_dri.so
+   ...
+}
+{
+   ignore_fglrx_dri_o
+   Memcheck:Overlap
+   ...
+   obj:/usr/lib/x86_64-linux-gnu/dri/fglrx_dri.so
+   ...
+}
+{
+   ignore_fglrx_dri_c
+   Memcheck:Cond
+   ...
+   obj:/usr/lib/x86_64-linux-gnu/dri/fglrx_dri.so
+   ...
+}
+{
+   ignore_fglrx_dri_p
+   Memcheck:Param
+   ioctl(generic)
+   ...
+   obj:/usr/lib/x86_64-linux-gnu/dri/fglrx_dri.so
+   ...
+}
diff --git a/view.c b/view.c
index ac9c5f21a55b72506a415996857d8c1fc4008c62..c17ed3056b401b18fb98e9c270b636beb6a91e81 100644 (file)
--- a/view.c
+++ b/view.c
@@ -470,11 +470,11 @@ static void highpass3_limited(vec3_t value, vec_t fracx, vec_t limitx, vec_t fra
 void V_CalcRefdefUsing (const matrix4x4_t *entrendermatrix, const vec3_t clviewangles, qboolean teleported, qboolean clonground, qboolean clcmdjump, float clstatsviewheight, qboolean cldead, qboolean clintermission, const vec3_t clvelocity)
 {
        float vieworg[3], viewangles[3], smoothtime;
-       float gunorg[3], gunangles[3];
+       float gunorg[3], gunangles[3] = {0};
        matrix4x4_t tmpmatrix;
-       
+
        static float viewheightavg;
-       float viewheight;       
+       float viewheight;
 #if 0
 // begin of chase camera bounding box size for proper collisions by Alexander Zubov
        vec3_t camboxmins = {-3, -3, -3};