Project

General

Profile

Bug #3025

register leak in D code generation

Added by Adam Leventhal about 8 years ago. Updated about 8 years ago.

Status:
Resolved
Priority:
Normal
Category:
DTrace
Start date:
2012-07-23
Due date:
% Done:

100%

Estimated time:
Difficulty:
Medium
Tags:
Gerrit CR:

Description

dt_cg_ptrsize() can leak a register:

185 dt_cg_ptrsize(dt_node_t dnp, dt_irlist_t *dlp, dt_regset_t *drp,
186 uint_t op, int dreg)
187 {
188 ctf_file_t *ctfp = dnp->dn_ctfp;
189 ctf_arinfo_t r;
190 dif_instr_t instr;
191 ctf_id_t type;
192 uint_t kind;
193 ssize_t size;
194 int sreg;
195
196 if ((sreg = dt_regset_alloc(drp)) == 1)
197 longjmp(yypcb
>pcb_jmpbuf, EDT_NOREG);
198
199 type = ctf_type_resolve(ctfp, dnp->dn_type);
200 kind = ctf_type_kind(ctfp, type);
201 assert(kind CTF_K_POINTER || kind CTF_K_ARRAY);
202
203 if (kind == CTF_K_ARRAY) {
204 if (ctf_array_info(ctfp, type, &r) != 0) {
205 yypcb->pcb_hdl->dt_ctferr = ctf_errno(ctfp);
206 longjmp(yypcb->pcb_jmpbuf, EDT_CTF);
207 }
208 type = r.ctr_contents;
209 } else
210 type = ctf_type_reference(ctfp, type);
211
212 if ((size = ctf_type_size(ctfp, type)) == 1)
213 return; /
multiply or divide by one can be omitted */ <---- LEAK!
214
215 dt_cg_setx(dlp, sreg, size);
216 instr = DIF_INSTR_FMT(op, dreg, sreg, dreg);
217 dt_irlist_append(dlp, dt_cg_node_alloc(DT_LBL_NONE, instr));
218 dt_regset_free(drp, sreg);
219 }

History

#1

Updated by Rich Lowe about 8 years ago

  • Status changed from In Progress to Resolved
  • % Done changed from 0 to 100
  • Tags deleted (needs-triage)

Resolved in r13758 commit:23432da34147

Also available in: Atom PDF