Opened 18 years ago

#1901 new defect

maptree.c: failure to check malloc() returns

Reported by: ttsai@… Owned by: sdlime
Priority: high Milestone:
Component: Shapefile Utilities Version: 4.10
Severity: normal Keywords:
Cc:

Description

maptree.c:
static treeNodeObj *treeNodeCreate(rectObj rect)
{
    treeNodeObj *node;

    node = (treeNodeObj *) malloc(sizeof(treeNodeObj));
---------------------------------------------------------
shptree core dumps while trying to index a 350M+ shapefile.  Temporarily added

    if (!node) {
        perror("treeNodeCreate");
        exit(1);
    }

to exit gracefully and to provide reason for failure (ok in this instance 
since only shptree.c calls this routine).  There are numerous other places 
where results of malloc() isn't checked in maptree.c - some could be very 
frustrating in out-of-memory conditions.

Tim

Change History (0)

Note: See TracTickets for help on using tickets.