diff options
author | Lukasz Majewski <l.majewski@majess.pl> | 2015-09-14 00:57:04 +0200 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2015-09-15 15:05:13 -0400 |
commit | 0226d8780b3886a4acdd2d4c9731419306d470f6 (patch) | |
tree | cf0f897c3310d286db5857c2ed4c73cecdec854e /lib/hashtable.c | |
parent | 817e48d8a2998b19dc36a77f8363b5f74bc3fa9e (diff) | |
download | u-boot-imx-0226d8780b3886a4acdd2d4c9731419306d470f6.zip u-boot-imx-0226d8780b3886a4acdd2d4c9731419306d470f6.tar.gz u-boot-imx-0226d8780b3886a4acdd2d4c9731419306d470f6.tar.bz2 |
env: import: hashtable: Free memory allocated before exiting from himport_r()
ithout this patch memory is not released on early exit.
Signed-off-by: Lukasz Majewski <l.majewski@majess.pl>
Diffstat (limited to 'lib/hashtable.c')
-rw-r--r-- | lib/hashtable.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/hashtable.c b/lib/hashtable.c index 7df424a..02b4105 100644 --- 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; } |