Add double free protection to checkseapp.

A double free error occurs when building with non glibc
devices. The hdestroy() function frees all comparison
keys internally in these cases. So avoid an explicit
call to free().

Change-Id: If9c5dc1a969605cd1eeb9218de02a9f8dbbd3ae1
Signed-off-by: rpcraig <rpcraig@tycho.ncsc.mil>
This commit is contained in:
rpcraig 2012-10-23 11:03:47 -04:00
parent 6766cc9e3c
commit 5dbfdc0b0f

View file

@ -428,8 +428,11 @@ static void rule_map_free(rule_map *rm, rule_map_switch s) {
free(m->data);
}
/* hdestroy() frees comparsion keys for non glibc */
#ifdef __GLIBC__
if(s == rule_map_destroy_key && rm->key)
free(rm->key);
#endif
free(rm);
}
@ -778,7 +781,10 @@ static void rule_add(rule_map *rm) {
*/
preserved_key = tmp->r->key;
rule_map_free(tmp->r, rule_map_preserve_key);
/* hdestroy() frees comparsion keys for non glibc */
#ifdef __GLIBC__
free(rm->key);
#endif
rm->key = preserved_key;
tmp->r = rm;
}