VirtualBox

Changeset 2290 in kBuild for trunk/src/kash/options.c


Ignore:
Timestamp:
Feb 27, 2009 4:08:07 AM (16 years ago)
Author:
bird
Message:

kash: malloc/free/friends gets a psh.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/kash/options.c

    r1238 r2290  
    280280        for (nparam = 0 ; argv[nparam] ; nparam++)
    281281                continue;
    282         ap = newparam = ckmalloc((nparam + 1) * sizeof *ap);
     282        ap = newparam = ckmalloc(psh, (nparam + 1) * sizeof *ap);
    283283        while (*argv) {
    284                 *ap++ = savestr(*argv++);
     284                *ap++ = savestr(psh, *argv++);
    285285        }
    286286        *ap = NULL;
    287         freeparam(&psh->shellparam);
     287        freeparam(psh, &psh->shellparam);
    288288        psh->shellparam.malloc = 1;
    289289        psh->shellparam.nparam = nparam;
     
    298298
    299299void
    300 freeparam(volatile struct shparam *param)
     300freeparam(shinstance *psh, volatile struct shparam *param)
    301301{
    302302        char **ap;
     
    304304        if (param->malloc) {
    305305                for (ap = param->p ; *ap ; ap++)
    306                         ckfree(*ap);
    307                 ckfree(param->p);
     306                        ckfree(psh, *ap);
     307                ckfree(psh, param->p);
    308308        }
    309309}
     
    330330        for (ap1 = psh->shellparam.p ; --n >= 0 ; ap1++) {
    331331                if (psh->shellparam.malloc)
    332                         ckfree(*ap1);
     332                        ckfree(psh, *ap1);
    333333        }
    334334        ap2 = psh->shellparam.p;
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette