imxtools: add const and set pointer to NULL on free to avoid double free
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30918 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
ae601954aa
commit
ad9e280281
2 changed files with 3 additions and 2 deletions
|
@ -30,7 +30,7 @@ bool g_debug = false;
|
|||
* Misc
|
||||
*/
|
||||
|
||||
void *memdup(void *p, size_t len)
|
||||
void *memdup(const void *p, size_t len)
|
||||
{
|
||||
void *cpy = xmalloc(len);
|
||||
memcpy(cpy, p, len);
|
||||
|
@ -156,6 +156,7 @@ void clear_keys()
|
|||
{
|
||||
free(g_key_array);
|
||||
g_nr_keys = 0;
|
||||
g_key_array = NULL;
|
||||
}
|
||||
|
||||
void add_keys_from_file(const char *key_file)
|
||||
|
|
|
@ -38,7 +38,7 @@ typedef struct crypto_key_t *key_array_t;
|
|||
int g_nr_keys;
|
||||
key_array_t g_key_array;
|
||||
|
||||
void *memdup(void *p, size_t len);
|
||||
void *memdup(const void *p, size_t len);
|
||||
void *augment_array(void *arr, size_t elem_sz, size_t cnt, void *aug, size_t aug_cnt);
|
||||
void generate_random_data(void *buf, size_t sz);
|
||||
void *xmalloc(size_t s);
|
||||
|
|
Loading…
Reference in a new issue