summaryrefslogtreecommitdiffstats
path: root/utils/imxtools/misc.c
diff options
context:
space:
mode:
authorAmaury Pouly <pamaury@rockbox.org>2011-11-06 19:41:25 +0000
committerAmaury Pouly <pamaury@rockbox.org>2011-11-06 19:41:25 +0000
commitad9e2802811da0b6540ae40348b806601d430f45 (patch)
treea34de9a1e66b14dd013c3ffc53b90f6545683364 /utils/imxtools/misc.c
parentae601954aac6eae74ffc2603031f7ebc617aeeb3 (diff)
downloadrockbox-ad9e2802811da0b6540ae40348b806601d430f45.tar.gz
rockbox-ad9e2802811da0b6540ae40348b806601d430f45.tar.bz2
rockbox-ad9e2802811da0b6540ae40348b806601d430f45.zip
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
Diffstat (limited to 'utils/imxtools/misc.c')
-rw-r--r--utils/imxtools/misc.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/utils/imxtools/misc.c b/utils/imxtools/misc.c
index 8d7cea89d7..7271ca8ab7 100644
--- a/utils/imxtools/misc.c
+++ b/utils/imxtools/misc.c
@@ -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)