• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /* Release uninterpreted chunk of the file contents.
2    Copyright (C) 2002 Red Hat, Inc.
3    Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
4 
5    This program is free software; you can redistribute it and/or modify
6    it under the terms of the GNU General Public License as published by
7    the Free Software Foundation, version 2.
8 
9    This program is distributed in the hope that it will be useful,
10    but WITHOUT ANY WARRANTY; without even the implied warranty of
11    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12    GNU General Public License for more details.
13 
14    You should have received a copy of the GNU General Public License
15    along with this program; if not, write to the Free Software Foundation,
16    Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
17 
18 #ifdef HAVE_CONFIG_H
19 # include <config.h>
20 #endif
21 
22 #include <libelf.h>
23 #include <stddef.h>
24 #include <stdlib.h>
25 
26 #include "libelfP.h"
27 
28 
29 void
gelf_freechunk(elf,ptr)30 gelf_freechunk (elf, ptr)
31      Elf *elf;
32      char *ptr;
33 {
34   if (elf == NULL)
35     /* No valid descriptor.  */
36     return;
37 
38   /* We do not have to do anything if the pointer returned by
39      gelf_rawchunk points into the memory allocated for the ELF
40      descriptor.  */
41   if (ptr < (char *) elf->map_address + elf->start_offset
42       || ptr >= ((char *) elf->map_address + elf->start_offset
43 		 + elf->maximum_size))
44     free (ptr);
45 }
46