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>
This commit is contained in:
Lukasz Majewski 2015-09-14 00:57:04 +02:00 committed by Tom Rini
parent 817e48d8a2
commit 0226d8780b

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