diff options
author | Arnaldo Carvalho de Melo <acme@redhat.com> | 2022-10-24 11:25:44 -0300 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2022-10-24 11:53:30 -0300 |
commit | 02d67c51765dfbd5893087da63744c864c7cc9e0 (patch) | |
tree | 8345d7b1ffe2e43cf75a3b0d8d17247387e8adb2 | |
parent | cd4d2d251e9a7f982be660f62ff9833506dfba10 (diff) | |
download | pahole-02d67c51765dfbd5893087da63744c864c7cc9e0.tar.gz |
pfunct: Use zalloc() to make the code more robust
Recently we had a problem where it was assumed that a field was
initialized to zeros but the constructor was using malloc(), check all
use and switch the ones allocating structs to zalloc() to prevent such
problems if we add extra fields to those structs.
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
-rw-r--r-- | pfunct.c | 2 |
1 files changed, 1 insertions, 1 deletions
@@ -53,7 +53,7 @@ struct fn_stats { static struct fn_stats *fn_stats__new(struct tag *tag, const struct cu *cu) { - struct fn_stats *stats = malloc(sizeof(*stats)); + struct fn_stats *stats = zalloc(sizeof(*stats)); if (stats != NULL) { const struct function *fn = tag__function(tag); |