File: 320_valgrind_fixes.patch

package info (click to toggle)
newt 0.52.2-10%2Betch1
  • links: PTS
  • area: main
  • in suites: etch
  • size: 836 kB
  • ctags: 27
  • sloc: makefile: 186; sh: 5
file content (64 lines) | stat: -rw-r--r-- 1,763 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
diff -ruN newt-0.52.2-old/label.c newt-0.52.2/label.c
--- newt-0.52.2-old/label.c	2006-09-29 15:16:18.000000000 +0100
+++ newt-0.52.2/label.c	2006-09-29 15:19:29.000000000 +0100
@@ -36,6 +36,7 @@
     co->top = top;
     co->left = left;
     co->takesFocus = 0;
+    co->isMapped = 0;
 
     la->length = strlen(text);
     la->text = strdup(text);
@@ -78,6 +79,8 @@
     struct label * la = co->data;
 
     free(la->text);
+    la->text = NULL;
     free(la);
+    co->data = NULL;
     free(co);
 }
diff -ruN newt-0.52.2-old/newt.c newt-0.52.2/newt.c
--- newt-0.52.2-old/newt.c	2006-09-29 15:16:18.000000000 +0100
+++ newt-0.52.2/newt.c	2006-09-29 15:22:51.000000000 +0100
@@ -248,24 +248,34 @@
 {
     FriBidiChar *out = NULL;
     static void *handle = NULL;
+    static int skip_out = 0;
 
     fribidi_boolean (*func_ptr) (FriBidiChar *, FriBidiStrIndex,
                                  FriBidiCharType *, FriBidiChar *,
                                  FriBidiStrIndex *, FriBidiStrIndex *,
                                  FriBidiLevel *);
 
+    if (skip_out)
+    	return NULL;
     dlerror();  /* clear error state */
-    if (!handle)
+    if (!handle) {
 	handle = dlopen("/usr/lib/libfribidi.so.0", RTLD_LAZY | RTLD_GLOBAL);
-    dlerror();
-    if (!handle)
+	/* call dlerror() on failure to clear error state in dlopen modules */
+	if (!handle) dlerror();
+    }
+    if (!handle) {
 	handle = dlopen("/lib/libfribidi.so.0", RTLD_LAZY | RTLD_GLOBAL);
-    if (!handle)
+    }
+    if (!handle) {
+    	dlerror();
+	skip_out = 1;
 	return NULL;
-
+    }
     func_ptr = dlsym(handle, "fribidi_log2vis");
     if (!func_ptr) {
-	dlclose(handle);
+    	skip_out = 1;
+	if (dlclose(handle)) 
+		dlerror();
 	handle = NULL;
 	return NULL;
     }