blob: 98edae099f84dfe7a1a613363d1e1488a04db9c2 (
plain)
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
|
Index: ruby-1.8.7-p299/ext/dl/handle.c
===================================================================
--- ruby-1.8.7-p299.orig/ext/dl/handle.c
+++ ruby-1.8.7-p299/ext/dl/handle.c
@@ -10,9 +10,12 @@ VALUE rb_cDLHandle;
void
dlhandle_free(struct dl_handle *dlhandle)
{
+ if (!dlhandle)
+ return;
if (dlhandle->ptr && dlhandle->open && dlhandle->enable_close) {
dlclose(dlhandle->ptr);
}
+ dlfree(dlhandle);
}
VALUE
Index: ruby-1.8.7-p299/ext/dl/ptr.c
===================================================================
--- ruby-1.8.7-p299.orig/ext/dl/ptr.c
+++ ruby-1.8.7-p299/ext/dl/ptr.c
@@ -45,6 +45,8 @@ rb_dlmem_aref(void *ptr)
void
dlptr_free(struct ptr_data *data)
{
+ if (!data)
+ return;
if (data->ptr) {
DEBUG_CODE({
printf("dlptr_free(): removing the pointer `0x%x' from the MemorySpace\n",
@@ -61,6 +63,7 @@ dlptr_free(struct ptr_data *data)
if (data->stype) dlfree(data->stype);
if (data->ssize) dlfree(data->ssize);
if (data->ids) dlfree(data->ids);
+ dlfree(data);
}
void
Index: ruby-1.8.7-p299/ext/dl/sym.c
===================================================================
--- ruby-1.8.7-p299.orig/ext/dl/sym.c
+++ ruby-1.8.7-p299/ext/dl/sym.c
@@ -57,6 +57,8 @@ char2type(int ch)
void
dlsym_free(struct sym_data *data)
{
+ if(!data)
+ return;
if( data->name ){
DEBUG_CODE({
printf("dlsym_free(): free(data->name:%s)\n",data->name);
@@ -69,6 +71,7 @@ dlsym_free(struct sym_data *data)
});
free(data->type);
}
+ dlfree(data);
}
VALUE
|