gjs r124 - trunk/gi



Author: walters
Date: Mon Dec  1 18:49:09 2008
New Revision: 124
URL: http://svn.gnome.org/viewvc/gjs?rev=124&view=rev

Log:
Bug 562892 - valgrind errors on get_obj_key

We were walking off the end of d.bytes; should instead explicitly
iterate over the bytes and multiply to get offset for buf.

Modified:
   trunk/gi/object.c

Modified: trunk/gi/object.c
==============================================================================
--- trunk/gi/object.c	(original)
+++ trunk/gi/object.c	Mon Dec  1 18:49:09 2008
@@ -1403,9 +1403,10 @@
         buf[1] = 's';
         buf[2] = '-';
         d.ptr = runtime;
-        for (i = 0; i < sizeof(void*)*2; i += 2) {
-            buf[OBJ_KEY_PREFIX_LEN+i] = 'a' + ((d.bytes[i] & 0xf0) >> 4);
-            buf[OBJ_KEY_PREFIX_LEN+i+1] = 'a' + (d.bytes[i] & 0x0f);
+        for (i = 0; i < sizeof(void*); i++) {
+        	int offset = OBJ_KEY_PREFIX_LEN+(i*2);
+        	buf[offset] = 'a' + ((d.bytes[i] & 0xf0) >> 4);
+        	buf[offset+1] = 'a' + (d.bytes[i] & 0x0f);
         }
         buf[OBJ_KEY_LEN] = '\0';
         strcpy(cached_buf, buf);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]