Changeset d496d66 in rtems-libbsd


Ignore:
Timestamp:
Nov 4, 2014, 10:56:59 AM (5 years ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
4.11, c1e05b9ea378b2971e3d7704779112b4bc4296da, freebsd-9.3, 4a77611a223ea883fb548679b516d326a020d447
Children:
ffbee8a
Parents:
a736dda
git-author:
Sebastian Huber <sebastian.huber@…> (11/04/14 10:56:59)
git-committer:
Sebastian Huber <sebastian.huber@…> (11/04/14 12:02:55)
Message:

mDNS: Avoid uninitialized memory

Use calloc() instead of malloc().

Location:
mDNSResponder/mDNSPosix
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • mDNSResponder/mDNSPosix/mDNSPosix.c

    ra736dda rd496d66  
    835835
    836836    // Allocate the interface structure itself.
    837     intf = (PosixNetworkInterface*)malloc(sizeof(*intf));
     837    intf = (PosixNetworkInterface*)calloc(1, sizeof(*intf));
    838838    if (intf == NULL) { assert(0); err = ENOMEM; }
    839839
     
    14341434}
    14351435
    1436 mDNSexport void *  mDNSPlatformMemAllocate(mDNSu32 len) { return(malloc(len)); }
     1436mDNSexport void *  mDNSPlatformMemAllocate(mDNSu32 len) { return(calloc(1, len)); }
    14371437mDNSexport void    mDNSPlatformMemFree    (void *mem)   { free(mem); }
    14381438
  • mDNSResponder/mDNSPosix/mDNSUNP.c

    ra736dda rd496d66  
    246246    len = 100 * sizeof(struct ifreq);   /* initial buffer size guess */
    247247    for ( ; ; ) {
    248         buf = (char*)malloc(len);
     248        buf = (char*)calloc(1, len);
    249249        if (buf == NULL) {
    250250            goto gotError;
Note: See TracChangeset for help on using the changeset viewer.