Author: kan
Date: Tue Jan 25 19:17:50 2011
New Revision: 217833
URL: http://svn.freebsd.org/changeset/base/217833

Log:
  Do not allocate buffer to hold data for zero-sized sections.

Modified:
  head/lib/libelf/elf_data.c

Modified: head/lib/libelf/elf_data.c
==============================================================================
--- head/lib/libelf/elf_data.c  Tue Jan 25 19:05:46 2011        (r217832)
+++ head/lib/libelf/elf_data.c  Tue Jan 25 19:17:50 2011        (r217833)
@@ -115,8 +115,10 @@ elf_getdata(Elf_Scn *s, Elf_Data *d)
        d->d_type    = elftype;
        d->d_version = e->e_version;
 
-       if (sh_type == SHT_NOBITS)
+       if (sh_type == SHT_NOBITS || sh_size == 0) {
+               STAILQ_INSERT_TAIL(&s->s_data, d, d_next);
                return (d);
+        }
 
        if ((d->d_buf = malloc(msz*count)) == NULL) {
                (void) _libelf_release_data(d);
_______________________________________________
[email protected] mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "[email protected]"

Reply via email to