This is an automated email from the git hooks/post-receive script.

guillem pushed a commit to branch master
in repository dpkg.

View the commit online:
https://git.dpkg.org/cgit/dpkg/dpkg.git/commit/?id=94886592cafa0bfbed76b8ab58814f657074d236

commit 94886592cafa0bfbed76b8ab58814f657074d236
Author: Guillem Jover <[email protected]>
AuthorDate: Thu Aug 29 01:32:15 2019 +0200

    libdpkg: Use the variable instead of a type as sizeof() argument
    
    This is more future proof, and in this particular case it was tripping
    over cppcheck and emitting a false positive for constArgument.
    
    Warned-by: cppcheck
---
 debian/changelog   | 1 +
 lib/dpkg/command.c | 4 ++--
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index b6b08c655..4af8bc1c7 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -40,6 +40,7 @@ dpkg (1.20.0) UNRELEASED; urgency=medium
     - Dpkg::OpenPGP: Make it possible to verify detached signatures.
     - Dpkg::OpenPGP: Add support for importing an OpenPGP key into a keyring.
     - Dpkg::BuildFlags: Remove unused hash keys.
+    - libdpkg: Use the variable instead of a type as sizeof() argument.
   * Build system:
     - Bump minimal Perl version to 5.24.1.
     - Add a serial versioning to the m4 files.
diff --git a/lib/dpkg/command.c b/lib/dpkg/command.c
index c8b8ae5af..ab89d4b9b 100644
--- a/lib/dpkg/command.c
+++ b/lib/dpkg/command.c
@@ -51,7 +51,7 @@ command_init(struct command *cmd, const char *filename, const 
char *name)
                cmd->name = name;
        cmd->argc = 0;
        cmd->argv_size = 10;
-       cmd->argv = m_malloc(cmd->argv_size * sizeof(const char *));
+       cmd->argv = m_malloc(cmd->argv_size * sizeof(cmd->argv[0]));
        cmd->argv[0] = NULL;
 }
 
@@ -85,7 +85,7 @@ command_grow_argv(struct command *cmd, int need)
                return;
 
        cmd->argv_size = (cmd->argv_size + need) * 2;
-       cmd->argv = m_realloc(cmd->argv, cmd->argv_size * sizeof(const char *));
+       cmd->argv = m_realloc(cmd->argv, cmd->argv_size * sizeof(cmd->argv[0]));
 }
 
 /**

-- 
Dpkg.Org's dpkg

Reply via email to