mirror of
https://github.com/openbsd/src.git
synced 2025-01-10 06:47:55 -08:00
plug three leaks, one reported and fixed by Andreas Gunnarsson in PR 5802,
the others by myself
This commit is contained in:
parent
45ff5c594b
commit
7444001d0e
@ -1,4 +1,4 @@
|
||||
/* $OpenBSD: bcode.c,v 1.36 2008/04/26 20:13:22 otto Exp $ */
|
||||
/* $OpenBSD: bcode.c,v 1.37 2008/04/28 06:35:09 otto Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2003, Otto Moerbeek <otto@drijf.net>
|
||||
@ -17,7 +17,7 @@
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
static const char rcsid[] = "$OpenBSD: bcode.c,v 1.36 2008/04/26 20:13:22 otto Exp $";
|
||||
static const char rcsid[] = "$OpenBSD: bcode.c,v 1.37 2008/04/28 06:35:09 otto Exp $";
|
||||
#endif /* not lint */
|
||||
|
||||
#include <ssl/ssl.h>
|
||||
@ -822,7 +822,7 @@ load_stack(void)
|
||||
{
|
||||
int idx;
|
||||
struct stack *stack;
|
||||
struct value *value, copy;
|
||||
struct value *value;
|
||||
|
||||
idx = readreg();
|
||||
if (idx >= 0) {
|
||||
@ -832,7 +832,7 @@ load_stack(void)
|
||||
value = stack_pop(stack);
|
||||
}
|
||||
if (value != NULL)
|
||||
push(stack_dup_value(value, ©));
|
||||
push(value);
|
||||
else
|
||||
warnx("stack register '%c' (0%o) is empty",
|
||||
idx, idx);
|
||||
@ -1550,6 +1550,7 @@ quitN(void)
|
||||
if (n == NULL)
|
||||
return;
|
||||
i = get_ulong(n);
|
||||
free_number(n);
|
||||
if (i == BN_MASK2 || i == 0)
|
||||
warnx("Q command requires a number >= 1");
|
||||
else if (bmachine.readsp < i)
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $OpenBSD: stack.c,v 1.9 2006/01/16 08:09:25 otto Exp $ */
|
||||
/* $OpenBSD: stack.c,v 1.10 2008/04/28 06:35:09 otto Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2003, Otto Moerbeek <otto@drijf.net>
|
||||
@ -17,7 +17,7 @@
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
static const char rcsid[] = "$OpenBSD: stack.c,v 1.9 2006/01/16 08:09:25 otto Exp $";
|
||||
static const char rcsid[] = "$OpenBSD: stack.c,v 1.10 2008/04/28 06:35:09 otto Exp $";
|
||||
#endif /* not lint */
|
||||
|
||||
#include <err.h>
|
||||
@ -308,8 +308,10 @@ array_grow(struct array *array, size_t newsize)
|
||||
size_t i;
|
||||
|
||||
array->data = brealloc(array->data, newsize * sizeof(*array->data));
|
||||
for (i = array->size; i < newsize; i++)
|
||||
for (i = array->size; i < newsize; i++) {
|
||||
array->data[i].type = BCODE_NONE;
|
||||
array->data[i].array = NULL;
|
||||
}
|
||||
array->size = newsize;
|
||||
}
|
||||
|
||||
@ -318,6 +320,7 @@ array_assign(struct array *array, size_t index, const struct value *v)
|
||||
{
|
||||
if (index >= array->size)
|
||||
array_grow(array, index+1);
|
||||
stack_free_value(&array->data[index]);
|
||||
array->data[index] = *v;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user