Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
ccan
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
mirror
ccan
Commits
03f017e9
Commit
03f017e9
authored
Aug 23, 2011
by
Rusty Russell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
jmap: fix jmap_free, tests.
Memory leak in tests revealed bug in jmap_free. Also, out-by-one error.
parent
3baf0eff
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
8 additions
and
2 deletions
+8
-2
ccan/jmap/jmap.c
ccan/jmap/jmap.c
+1
-1
ccan/jmap/test/run-ptridx-type.c
ccan/jmap/test/run-ptridx-type.c
+4
-1
ccan/jmap/test/run-uintidx-type.c
ccan/jmap/test/run-uintidx-type.c
+3
-0
No files found.
ccan/jmap/jmap.c
View file @
03f017e9
...
@@ -43,6 +43,6 @@ const char *jmap_error_(struct jmap *map)
...
@@ -43,6 +43,6 @@ const char *jmap_error_(struct jmap *map)
void
jmap_free
(
const
struct
jmap
*
map
)
void
jmap_free
(
const
struct
jmap
*
map
)
{
{
free
((
char
*
)
map
->
errstr
);
free
((
char
*
)
map
->
errstr
);
Judy
1
FreeArray
((
PPvoid_t
)
&
map
->
judy
,
PJE0
);
Judy
L
FreeArray
((
PPvoid_t
)
&
map
->
judy
,
PJE0
);
free
((
void
*
)
map
);
free
((
void
*
)
map
);
}
}
ccan/jmap/test/run-ptridx-type.c
View file @
03f017e9
...
@@ -17,7 +17,7 @@ static int cmp_ptr(const void *a, const void *b)
...
@@ -17,7 +17,7 @@ static int cmp_ptr(const void *a, const void *b)
int
main
(
int
argc
,
char
*
argv
[])
int
main
(
int
argc
,
char
*
argv
[])
{
{
struct
jmap_foo
*
map
;
struct
jmap_foo
*
map
;
struct
foo
*
foo
[
NUM
],
**
foop
;
struct
foo
*
foo
[
NUM
+
1
],
**
foop
;
struct
idx
*
idx
[
NUM
+
1
],
*
index
;
struct
idx
*
idx
[
NUM
+
1
],
*
index
;
unsigned
int
i
;
unsigned
int
i
;
...
@@ -97,5 +97,8 @@ int main(int argc, char *argv[])
...
@@ -97,5 +97,8 @@ int main(int argc, char *argv[])
ok1
(
jmap_foo_error
(
map
)
==
NULL
);
ok1
(
jmap_foo_error
(
map
)
==
NULL
);
jmap_foo_free
(
map
);
jmap_foo_free
(
map
);
for
(
i
=
0
;
i
<
NUM
+
1
;
i
++
)
free
(
foo
[
i
]);
return
exit_status
();
return
exit_status
();
}
}
ccan/jmap/test/run-uintidx-type.c
View file @
03f017e9
...
@@ -126,5 +126,8 @@ int main(int argc, char *argv[])
...
@@ -126,5 +126,8 @@ int main(int argc, char *argv[])
ok1
(
jmap_foo_error
(
map
)
==
NULL
);
ok1
(
jmap_foo_error
(
map
)
==
NULL
);
jmap_foo_free
(
map
);
jmap_foo_free
(
map
);
for
(
i
=
0
;
i
<
NUM
;
i
++
)
free
(
foo
[
i
]);
return
exit_status
();
return
exit_status
();
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment