From 90e61788a146e5c38f06f17a30d624529b75ac7d Mon Sep 17 00:00:00 2001 From: mickey Date: Fri, 4 Apr 1997 21:52:40 +0000 Subject: [PATCH] init allocated memory. --- distrib/crunch/crunchgen/crunchgen.c | 6 +++--- distrib/crunch/crunchide/crunchide.c | 4 ++-- distrib/crunch/crunchide/elf_hide.c | 6 +++--- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/distrib/crunch/crunchgen/crunchgen.c b/distrib/crunch/crunchgen/crunchgen.c index 2165d7ae9e1..76dcfa0928d 100644 --- a/distrib/crunch/crunchgen/crunchgen.c +++ b/distrib/crunch/crunchgen/crunchgen.c @@ -1,4 +1,4 @@ -/* $OpenBSD: crunchgen.c,v 1.9 1997/01/31 19:40:42 rahnds Exp $ */ +/* $OpenBSD: crunchgen.c,v 1.10 1997/04/04 21:52:40 mickey Exp $ */ /* * Copyright (c) 1994 University of Maryland * All Rights Reserved. @@ -340,7 +340,7 @@ void add_prog(char *progname) for(p1 = NULL, p2 = progs; p2 != NULL; p1 = p2, p2 = p2->next) if(!strcmp(p2->name, progname)) return; - p2 = malloc(sizeof(prog_t)); + p2 = calloc(1, sizeof(prog_t)); if(p2) p2->name = strdup(progname); if(!p2 || !p2->name) out_of_memory(); @@ -884,7 +884,7 @@ void add_string(strlst_t **listp, char *str) for(p1 = NULL, p2 = *listp; p2 != NULL; p1 = p2, p2 = p2->next) if(!strcmp(p2->str, str)) return; - p2 = malloc(sizeof(strlst_t)); + p2 = calloc(1,sizeof(strlst_t)); if(p2) p2->str = strdup(str); if(!p2 || !p2->str) out_of_memory(); diff --git a/distrib/crunch/crunchide/crunchide.c b/distrib/crunch/crunchide/crunchide.c index 341682ea92c..321f1b7c825 100644 --- a/distrib/crunch/crunchide/crunchide.c +++ b/distrib/crunch/crunchide/crunchide.c @@ -135,7 +135,7 @@ void add_to_keep_list(char *symbol) if(curp && cmp == 0) return; /* already in table */ - newp = (struct keep *) malloc(sizeof(struct keep)); + newp = (struct keep *) calloc(1,sizeof(struct keep)); if(newp) newp->sym = strdup(symbol); if(newp == NULL || newp->sym == NULL) { fprintf(stderr, "%s: out of memory for keep list\n", pname); @@ -263,7 +263,7 @@ void hide_syms(char *filename) * read the header and from TRELOFF to the end of the file. */ - if((aoutdata = (char *) malloc(infstat.st_size)) == NULL) { + if((aoutdata = (char *) calloc(1,infstat.st_size)) == NULL) { fprintf(stderr, "%s: too big to read into memory\n", filename); close(inf); return; diff --git a/distrib/crunch/crunchide/elf_hide.c b/distrib/crunch/crunchide/elf_hide.c index 37e98522d69..415601a1f46 100644 --- a/distrib/crunch/crunchide/elf_hide.c +++ b/distrib/crunch/crunchide/elf_hide.c @@ -1,4 +1,4 @@ -/* $OpenBSD: elf_hide.c,v 1.1 1997/01/09 04:16:52 rahnds Exp $ */ +/* $OpenBSD: elf_hide.c,v 1.2 1997/04/04 21:52:42 mickey Exp $ */ /* * Copyright (c) 1997 Dale Rahn. All rights reserved. @@ -347,8 +347,8 @@ reorder_syms(Elf32_Ehdr *ehdr, Elf32_Shdr *symsect, nsyms = symtabsize / sizeof(Elf32_Sym); - tmpsymtab = (Elf32_Sym *)malloc(symtabsize); - symmap = (Symmap *)malloc( sizeof(Symmap) * (nsyms)); + tmpsymtab = (Elf32_Sym *)calloc(1,symtabsize); + symmap = (Symmap *)calloc(1, sizeof(Symmap) * (nsyms)); assert (NULL != tmpsymtab); -- 2.20.1