[easytag/wip/clang-analyzer] Fix sizeof operand in libapetag_maloc_cont_int
- From: David King <davidk src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [easytag/wip/clang-analyzer] Fix sizeof operand in libapetag_maloc_cont_int
- Date: Mon, 12 Aug 2013 16:45:45 +0000 (UTC)
commit 0bd3a28efef2e3d0c43074517e565d2912712b6f
Author: David King <amigadave amigadave com>
Date: Mon Aug 12 17:38:25 2013 +0100
Fix sizeof operand in libapetag_maloc_cont_int
Found with the Clang static analyzer.
src/libapetag/apetaglib.c | 5 ++---
1 files changed, 2 insertions(+), 3 deletions(-)
---
diff --git a/src/libapetag/apetaglib.c b/src/libapetag/apetaglib.c
index 6f5d3b1..a41bd5d 100644
--- a/src/libapetag/apetaglib.c
+++ b/src/libapetag/apetaglib.c
@@ -138,8 +138,7 @@ libapetag_maloc_cont_int (apetag *mem_cnt, struct tag *mTag)
struct tag **tag_tmp = mem_cnt->tag;
if (mem_cnt->memTagAlloc == 0) { /* init */
- mem_cnt->tag = (struct tag **)
- malloc (((sizeof (struct tag **)) * (LIBAPETAG_MEM_ALLOC_AHEAD)));
+ mem_cnt->tag = (struct tag **) malloc ((sizeof (struct tag *) * LIBAPETAG_MEM_ALLOC_AHEAD));
mem_cnt->memTagAlloc = LIBAPETAG_MEM_ALLOC_AHEAD;
mem_cnt->countTag = 0;
if (mem_cnt->tag == NULL) {
@@ -150,7 +149,7 @@ libapetag_maloc_cont_int (apetag *mem_cnt, struct tag *mTag)
}
if ((mem_cnt->memTagAlloc) <= (mem_cnt->countTag + 1)) {
- mem_cnt->tag = (struct tag **) realloc (mem_cnt->tag, ((sizeof (struct tag **)) *
+ mem_cnt->tag = (struct tag **) realloc (mem_cnt->tag, (sizeof (struct tag *) *
(mem_cnt->memTagAlloc + LIBAPETAG_MEM_ALLOC_AHEAD)));
mem_cnt->memTagAlloc += LIBAPETAG_MEM_ALLOC_AHEAD;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]