summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWalter Harms <wharms@bfs.de>2019-08-19 17:52:16 +0200
committerWalter Harms <wharms@bfs.de>2019-08-19 17:52:16 +0200
commit956c0e145a87d2b19144d820c33c3d64ac348043 (patch)
tree28e09a0530338c947f1578f30102fcf1e94b878f
parent91860c7f6ab6e18bb2e0f0bfaa38e09274c6cc2e (diff)
FIX: malloc+memset=calloc
libc has a function to provide clean memory, so use it Signed-off-by: Walter Harms <wharms@bfs.de>
-rw-r--r--xrestop.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/xrestop.c b/xrestop.c
index e08ff07..c3e2d3a 100644
--- a/xrestop.c
+++ b/xrestop.c
@@ -260,8 +260,7 @@ xrestop_client_new(XResTopApp *app)
{
XResTopClient *client = NULL;
- client = malloc(sizeof(XResTopClient));
- memset(client, 0, sizeof(XResTopClient));
+ client = calloc(1,sizeof(XResTopClient));
client->pid = -1;
@@ -643,8 +642,7 @@ main(int argc, char **argv)
int i, event, error, major, minor;
XResTopApp *app = NULL;
- app = malloc(sizeof(XResTopApp));
- memset(app, 0, sizeof(XResTopApp));
+ app = calloc(1,sizeof(XResTopApp));
app->delay = 2;