Browse Source

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>
scm-imx_v2016.03_4.1.15_2.0.0_ga
Lukasz Majewski 5 years ago
committed by Tom Rini
parent
commit
0226d8780b
1 changed files with 4 additions and 1 deletions
  1. +4
    -1
      lib/hashtable.c

+ 4
- 1
lib/hashtable.c View File

@ -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;
}


Loading…
Cancel
Save