[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 03/12] libpoke: Fix `muls` insn to use `pvm_alloc`
From: |
Jose E. Marchesi |
Subject: |
Re: [PATCH 03/12] libpoke: Fix `muls` insn to use `pvm_alloc` |
Date: |
Thu, 27 May 2021 13:49:30 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) |
> @@ -4213,14 +4213,13 @@ instruction muls ()
> code
> pvm_val str = JITTER_UNDER_TOP_STACK ();
> size_t i, num = PVM_VAL_ULONG (JITTER_TOP_STACK ());
> - char *res = xmalloc (strlen (PVM_VAL_STR (str)) * num + 1);
> + char *res = pvm_alloc (strlen (PVM_VAL_STR (str)) * num + 1);
>
> *res = '\0';
> for (i = 0; i < num; ++i)
> strcat (res, PVM_VAL_STR (str));
>
> - JITTER_PUSH_STACK (pvm_make_string (res));
> - free (res);
> + JITTER_PUSH_STACK (pvm_make_string_nodup (res));
> end
> end
So we were leaking memory there...
OK for both master and maint/poke-1.
Thanks!
- [PATCH 00/12] Add format function, Mohammad-Reza Nabipoor, 2021/05/25
- [PATCH 01/12] Update contact info of mnabipoor, Mohammad-Reza Nabipoor, 2021/05/25
- [PATCH 03/12] libpoke: Fix `muls` insn to use `pvm_alloc`, Mohammad-Reza Nabipoor, 2021/05/25
- Re: [PATCH 03/12] libpoke: Fix `muls` insn to use `pvm_alloc`,
Jose E. Marchesi <=
- [PATCH 02/12] doc/learn-poke-in-y-minutes.pk: Update, Mohammad-Reza Nabipoor, 2021/05/25
- [PATCH 04/12] libpoke/pvm.jitter: Use more `pvm_make_string_nodup`, Mohammad-Reza Nabipoor, 2021/05/25
- [PATCH 05/12] libpoke/pkl-rt.pk: Fix typo s/gigi/gibi/, Mohammad-Reza Nabipoor, 2021/05/25