projects
/
project
/
bcm63xx
/
u-boot.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
817e48d
)
env: import: hashtable: Free memory allocated before exiting from himport_r()
author
Lukasz Majewski
<l.majewski@majess.pl>
Sun, 13 Sep 2015 22:57:04 +0000
(
00:57
+0200)
committer
Tom Rini
<trini@konsulko.com>
Tue, 15 Sep 2015 19:05:13 +0000
(15:05 -0400)
ithout this patch memory is not released on early exit.
Signed-off-by: Lukasz Majewski <l.majewski@majess.pl>
lib/hashtable.c
patch
|
blob
|
history
diff --git
a/lib/hashtable.c
b/lib/hashtable.c
index 7df424ad87a6e901cbfb02d224316b3f665341fb..02b41050a44f6656e9605e288f5f6a97faf3539c 100644
(file)
--- a/
lib/hashtable.c
+++ b/
lib/hashtable.c
@@
-842,8
+842,10
@@
int himport_r(struct hsearch_data *htab,
}
}
- if(!size)
+ if (!size) {
+ free(data);
return 1; /* everything OK */
+ }
if(crlf_is_lf) {
/* Remove Carriage Returns in front of Line Feeds */
unsigned ignored_crs = 0;
@@
-907,6
+909,7
@@
int himport_r(struct hsearch_data *htab,
if (*name == 0) {
debug("INSERT: unable to use an empty key\n");
__set_errno(EINVAL);
+ free(data);
return 0;
}