Itk - the [incr Tk] extension

Check-in [46e858f9ac]
Login
Bounty program for improvements to Tcl and certain Tcl packages.
Tcl 2019 Conference, Houston/TX, US, Nov 4-8
Send your abstracts to tclconference@googlegroups.com
or submit via the online form by Sep 9.

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:[6acb6a8363] When Itk_AddOptionPart() fails, be sure no remnant of the failed attempt remains to lead to nasty double free.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | dgp-method-type
Files: files | file ages | folders
SHA1:46e858f9ac3f01ecfdc1c97b8da79cbbc35e1219
User & Date: dgp 2017-07-10 18:32:51
Context
2017-07-28
16:57
Several revisions to get evaluation contexts more reliably correct. Closed-Leaf check-in: b46f3c3fe0 user: dgp tags: dgp-method-type
2017-07-25
20:35
Attempt to make code say clearly what it does, instead of achieving so much with namespace context games. check-in: 4af9618d9b user: dgp tags: experiment
2017-07-10
18:32
[6acb6a8363] When Itk_AddOptionPart() fails, be sure no remnant of the failed attempt remains to lead to nasty double free. check-in: 46e858f9ac user: dgp tags: dgp-method-type
2017-06-29
17:17
Bump to 4.1.0 check-in: c368859cb1 user: dgp tags: dgp-method-type
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to generic/itkArchBase.c.

  2251   2251       char *currVal,                   /* current value (or NULL) */
  2252   2252       ArchOptionPart *optPart,         /* part to be added in */
  2253   2253       ArchOption **raOpt)              /* returns: option containing new part */
  2254   2254   {
  2255   2255       CONST char *init = NULL;
  2256   2256       int result;
  2257   2257       ArchOption *archOpt;
         2258  +    Itcl_ListElem *elemPtr;
  2258   2259   
  2259   2260       *raOpt = NULL;
  2260   2261       archOpt = NULL;
  2261   2262   
  2262   2263       /*
  2263   2264        *  Find or create a composite option for the mega-widget.
  2264   2265        */
................................................................................
  2271   2272   
  2272   2273       /*
  2273   2274        *  Add the option part to the composite option.  If the
  2274   2275        *  composite option has already been configured, then
  2275   2276        *  simply update this part to the current value.  Otherwise,
  2276   2277        *  leave the configuration to Itk_ArchInitCmd().
  2277   2278        */
  2278         -    Itcl_AppendList(&archOpt->parts, (ClientData)optPart);
         2279  +    elemPtr = Itcl_AppendList(&archOpt->parts, (ClientData)optPart);
  2279   2280   
  2280   2281       if ((archOpt->flags & ITK_ARCHOPT_INIT) != 0) {
  2281   2282   
  2282   2283           if (result == TCL_OK) {
  2283   2284               init = Tcl_GetVar2(interp, "itk_option", archOpt->switchName, 0);
  2284   2285           }
  2285   2286   
  2286   2287           if (!init) {
  2287   2288               Itk_ArchOptAccessError(interp, info, archOpt);
         2289  +	    Itcl_DeleteListElem(elemPtr);
  2288   2290               return TCL_ERROR;
  2289   2291           }
  2290   2292   
  2291   2293           if (!currVal || (strcmp(init,currVal) != 0)) {
  2292   2294               result  = (*optPart->configProc)(interp, info->itclObj,
  2293   2295                   optPart->clientData, init);
  2294   2296   
  2295   2297               if (result != TCL_OK) {
  2296   2298                   Itk_ArchOptConfigError(interp, info, archOpt);
         2299  +		Itcl_DeleteListElem(elemPtr);
  2297   2300                   return TCL_ERROR;
  2298   2301               }
  2299   2302           }
  2300   2303       }
  2301   2304   
  2302   2305       *raOpt = archOpt;
  2303   2306       return TCL_OK;