main/bc: fix memleak

patch from gentoo
This commit is contained in:
Natanael Copa 2015-05-05 06:09:33 +00:00
parent bffa702b79
commit 32411a06d5
2 changed files with 50 additions and 4 deletions

View File

@ -2,17 +2,18 @@
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=bc
pkgver=1.06.95
pkgrel=1
pkgrel=2
pkgdesc="An arbitrary precision numeric processing language (calculator)"
url="http://www.gnu.org/software/bc/bc.html"
arch="all"
license="GPL2+"
depends=""
makedepends="flex readline-dev texinfo"
makedepends="flex bison readline-dev texinfo"
install=""
subpackages="$pkgname-doc"
source="ftp://alpha.gnu.org/gnu/bc/bc-$pkgver.tar.bz2
bc-1.06.95-void_uninitialized.patch"
bc-1.06.95-memory_leak-1.patch
"
_builddir="$srcdir"/$pkgname-$pkgver
prepare() {
@ -43,4 +44,8 @@ package() {
}
md5sums="5126a721b73f97d715bb72c13c889035 bc-1.06.95.tar.bz2
c83b1973eb393d3b3254d7815a7e152b bc-1.06.95-void_uninitialized.patch"
877e81fba316fe487ec23501059d54b8 bc-1.06.95-memory_leak-1.patch"
sha256sums="7ee4abbcfac03d8a6e1a8a3440558a3d239d6b858585063e745c760957725ecc bc-1.06.95.tar.bz2
9e9279f1c2c4b83f3dab9672563bb02087776f04bb43eec135af117e6d4f83fb bc-1.06.95-memory_leak-1.patch"
sha512sums="16ec13f87ef76ad4de77d378ef8d65a582adca1bf661c9d7675e78d940680c77e81a00a01817fde7c1ad1524562d6f933caa5c42a0686f3f85aadbb39393afb1 bc-1.06.95.tar.bz2
ee655b87f7fbbd7ce9a85218d38f5a971433691e7d34aff8c122b4e5ff94490c7441001dd73da8bab623a29548cd295ef9c3ae760ebf39f4825cc044d35d4eb6 bc-1.06.95-memory_leak-1.patch"

View File

@ -0,0 +1,41 @@
Submitted By: Bruce Dubbs (bdubbs at linuxfromscratch dot org)
Date: 2014-04-18
Initial Package Version: 1.06.95
Origin: Gentoo
Description: Fixes memory leaks and an uninitialized variable
diff -Naur bc-1.06.95.orig/bc/bc.y bc-1.06.95/bc/bc.y
--- bc-1.06.95.orig/bc/bc.y 2006-09-04 21:39:31.000000000 -0500
+++ bc-1.06.95/bc/bc.y 2014-04-09 13:27:04.602661243 -0500
@@ -569,6 +569,7 @@
generate (">");
break;
}
+ free($2);
}
| expression '+' expression
{
diff -Naur bc-1.06.95.orig/bc/storage.c bc-1.06.95/bc/storage.c
--- bc-1.06.95.orig/bc/storage.c 2006-09-04 21:39:31.000000000 -0500
+++ bc-1.06.95/bc/storage.c 2014-04-09 13:28:11.770763410 -0500
@@ -99,6 +99,7 @@
{
f = &functions[indx];
f->f_defined = FALSE;
+ f->f_void = FALSE;
f->f_body = (char *) bc_malloc (BC_START_SIZE);
f->f_body_size = BC_START_SIZE;
f->f_code_size = 0;
diff -Naur bc-1.06.95.orig/bc/util.c bc-1.06.95/bc/util.c
--- bc-1.06.95.orig/bc/util.c 2006-09-04 21:39:31.000000000 -0500
+++ bc-1.06.95/bc/util.c 2014-04-09 13:27:39.841190064 -0500
@@ -602,8 +602,7 @@
case FUNCTDEF:
if (id->f_name != 0)
{
- if (namekind != FUNCT)
- free(name);
+ free(name);
/* Check to see if we are redefining a math lib function. */
if (use_math && namekind == FUNCTDEF && id->f_name <= 6)
id->f_name = next_func++;