bug-gv
[Top][All Lists]
Advanced

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

Re: [bug-gv] heisenbug disabling BBox


From: Bernhard R. Link
Subject: Re: [bug-gv] heisenbug disabling BBox
Date: Wed, 3 Aug 2011 13:07:34 +0200
User-agent: Mutt/1.5.20 (2009-06-14)

* Bernhard R. Link <address@hidden> [110803 12:17]:
>   Looking at dsc_strncmp I see nothing that could explain why
>   a difference like that could have effects like that.
>   As it does this funny malloc/free every time (no idea why
>   it does that as it could just to strncasecmp(s1, s2, n-1))
>   that might mean that there simply is some harvoc going on
>   with the memory mangement code. Optimising that function to
>   not do the temporary copy makes the bug disappear, but that
>   might simply be a code moves around effect....

Actually, the bug still show up with the malloc/free/strncpy
removed with the following patch:

index 248081c..ccc3ca1 100644
--- a/gv/src/ps.c
+++ b/gv/src/ps.c
@@ -115,17 +119,10 @@ static int dsc_strncmp(s1, s2, n)
 {
- char *tmp;    
-
  if (strncasecmp(s1, s2, n) == 0)
         return 0;
  if (s2[n-1] == ':'){
-        tmp = (char *) malloc(n*sizeof(char));
-        strncpy(tmp, s2, (n-1));
-        tmp[n-1]=' ';
-        if (strncasecmp(s1, tmp, n) == 0){
-                free(tmp);
+        if (strncasecmp(s1, s2, n-1) == 0 && s1[n-1] == ' '){
                 return 0;
         }
-        free(tmp);
  }
  
  return 1;

In other words: I'm totally at loss how this effect can
cause this. I will try to run it in the debugger with some
read watchpoints for the changed parts to see where it can
have a difference, but ....

        Bernhard R. Link



reply via email to

[Prev in Thread] Current Thread [Next in Thread]