DELETE_ARRAY in /inkbugs/inkscape/src/trace/quantize.cpp
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Inkscape |
Fix Released
|
Medium
|
Jon A. Cruz |
Bug Description
DELETE_ARRAY in /inkbugs/
In rgbMapQuantize(
Using non-array delete on an array of objects; should be using delete[] (CWE-459).
557
Using new in : "new RGB[ncolor]".
Assigning: "rgbpal" = storage from "new RGB[ncolor]".
558 RGB *rgbpal = new RGB[ncolor];
559 int indexes = 0;
560 octreeIndex(tree, rgbpal, &indexes);
561
562 octreeDelete(&pool, tree);
563
564 // stacking with increasing contrasts
565 qsort((void *)rgbpal, indexes, sizeof(RGB), compRGB);
566
567 // make the new map
568 IndexedMap *newmap = IndexedMapCreat
At conditional (1): "!newmap" taking the true branch.
Deleting array variable "rgbpal" with non-array delete in "delete rgbpal".
569 if (!newmap) { delete rgbpal; return NULL; }
...
585
Deleting array variable "rgbpal" with non-array delete in "delete rgbpal".
586 delete rgbpal;
Changed in inkscape: | |
status: | New → In Progress |
status: | In Progress → Fix Committed |
Changed in inkscape: | |
status: | Fix Committed → Fix Released |
fix suggestions 2010-07-25:
569 if (!newmap) { delete[] rgbpal; return NULL; }
586 delete[] rgbpal;
fix reason:
delete only releases the first element of an array; delete[] releases the entire array.