summaryrefslogtreecommitdiffstats
path: root/libopkg
diff options
context:
space:
mode:
authorticktock35 <ticktock35@e8e0d7a0-c8d9-11dd-a880-a1081c7ac358>2009-02-03 07:04:38 (EST)
committer ticktock35 <ticktock35@e8e0d7a0-c8d9-11dd-a880-a1081c7ac358>2009-02-03 07:04:38 (EST)
commitf5afe41a675508672a51d90b84d61a124cd8939d (patch)
tree80a9f8f3c83ba73f052cf2cc45b10fb478a67ccb /libopkg
parentcfba4480171339c774f2c19358859df7fd0124bd (diff)
reduce a meory leak
git-svn-id: http://opkg.googlecode.com/svn/trunk@200 e8e0d7a0-c8d9-11dd-a880-a1081c7ac358
Diffstat (limited to 'libopkg')
-rw-r--r--libopkg/pkg.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/libopkg/pkg.c b/libopkg/pkg.c
index 5096ba0..98a929c 100644
--- a/libopkg/pkg.c
+++ b/libopkg/pkg.c
@@ -17,6 +17,7 @@
#include "includes.h"
#include <ctype.h>
+#include <alloca.h>
#include <string.h>
#include <stdbool.h>
#include <errno.h>
@@ -461,7 +462,10 @@ void set_flags_from_control(opkg_conf_t *conf, pkg_t *pkg){
char **raw =NULL;
char **raw_start=NULL;
- temp_str = (char *) calloc (1, strlen(pkg->dest->info_dir)+strlen(pkg->name)+12);
+ size_t str_size = strlen(pkg->dest->info_dir)+strlen(pkg->name)+12;
+ temp_str = (char *) alloca (str_size);
+ memset(temp_str, 0 , str_size);
+
if (temp_str == NULL ){
opkg_message(conf, OPKG_INFO, "Out of memory in %s\n", __FUNCTION__);
return;
@@ -486,7 +490,6 @@ void set_flags_from_control(opkg_conf_t *conf, pkg_t *pkg){
}
free(raw_start);
- free(temp_str);
return ;