Print this page
10138 smatch fixes for usr/src/cmd/sgs

Split Close
Expand all
Collapse all
          --- old/usr/src/cmd/sgs/libelf/common/ar.c
          +++ new/usr/src/cmd/sgs/libelf/common/ar.c
↓ open down ↓ 20 lines elided ↑ open up ↑
  21   21  
  22   22  /*
  23   23   * Copyright (c) 1990, 2010, Oracle and/or its affiliates. All rights reserved.
  24   24   */
  25   25  
  26   26  /*
  27   27   *      Copyright (c) 1988 AT&T
  28   28   *        All Rights Reserved
  29   29   */
  30   30  
       31 +/*
       32 + * Copyright (c) 2018, Joyent, Inc.
       33 + */
       34 +
  31   35  #include <ar.h>
  32   36  #include <stdlib.h>
  33   37  #include <memory.h>
  34   38  #include <errno.h>
  35   39  #include <libelf.h>
  36   40  #include "decl.h"
  37   41  #include "msg.h"
  38   42  #include "member.h"
  39   43  
  40   44  #define MANGLE  '\177'
↓ open down ↓ 108 lines elided ↑ open up ↑
 149  153           * free memlist ident.
 150  154           */
 151  155          if ((m = (Member *)malloc(sizeof (Member))) == 0) {
 152  156                  _elf_seterr(EMEM_ARMEM, errno);
 153  157                  return (0);
 154  158          }
 155  159          if ((elf->ed_memlist == 0) || (ol->m_free == ol->m_end)) {
 156  160                  if ((l = (Memlist *)malloc(sizeof (Memlist) +
 157  161                      (sizeof (Memident) * MEMIDENTNO))) == 0) {
 158  162                          _elf_seterr(EMEM_ARMEM, errno);
      163 +                        free(m);
 159  164                          return (0);
 160  165                  }
 161  166                  l->m_next = 0;
 162  167                  l->m_free = (Memident *)(l + 1);
 163  168                  l->m_end = (Memident *)((uintptr_t)l->m_free +
 164  169                      (sizeof (Memident) * MEMIDENTNO));
 165  170  
 166  171                  if (elf->ed_memlist == 0)
 167  172                          elf->ed_memlist = l;
 168  173                  else
↓ open down ↓ 174 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX