am 5dbfdc0b: Add double free protection to checkseapp.

* commit '5dbfdc0b0fec04d670912c4eed179983f98abe8a':
  Add double free protection to checkseapp.
This commit is contained in:
rpcraig 2012-10-23 16:07:27 -07:00 committed by Android Git Automerger
commit 8f4600c0f8

View file

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