OpenSolaris

Printable Version Enter a New Search
Bug ID 4846556
Synopsis libmalloc misses valloc and memalign
State 11-Closed:Verified (Closed)
Category:Subcategory library:other
Keywords
Responsible Engineer Ralph Turner
Reported Against 1.0 , 5.9 , 5.0_28 , s10_01 , 4.0_patch6
Duplicate Of
Introduced In
Commit to Fix snv_15
Fixed In snv_15
Release Fixed solaris_nevada(snv_15)
Related Bugs 4903861 , 4755634
Submit Date 10-April-2003
Last Update Date 9-November-2009
Description
A simple test case shows the problem when compiled with -lmalloc:

% cat main.c
#include <stdio.h>
#include <stdlib.h>

int
main() {
    void *p1 = valloc(16);
    printf("p1 = 0x%lx\n", p1 );
    free( p1 );
    return 0;
}

% cc -o main -lmalloc main.c
% main
p1 = 0x22000
Segmentation Fault (core dumped)

The reason for that is that vallos is used from libc.so and allocates memory
from its heap. Free is used from libmalloc.so and it frees an arbitrary pointer
from its heap's point of view.
Work Around
N/A
Comments
N/A