summaryrefslogtreecommitdiffstats
path: root/libopkg/opkg_download.c
diff options
context:
space:
mode:
authorgraham.gower <graham.gower@e8e0d7a0-c8d9-11dd-a880-a1081c7ac358>2009-11-03 22:14:59 (EST)
committer graham.gower <graham.gower@e8e0d7a0-c8d9-11dd-a880-a1081c7ac358>2009-11-03 22:14:59 (EST)
commit11af232b19155c76002b5ca1f2b0e89d75699d3a (patch)
tree5e113943ec678935d2ae1ac60b7e70bd49165f6e /libopkg/opkg_download.c
parentedf1b1964b565726a0b0f730b109e4491c7929b9 (diff)
s/strdup/xstrdup/ - check memory allocations for failure.
git-svn-id: http://opkg.googlecode.com/svn/trunk@255 e8e0d7a0-c8d9-11dd-a880-a1081c7ac358
Diffstat (limited to 'libopkg/opkg_download.c')
-rw-r--r--libopkg/opkg_download.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/libopkg/opkg_download.c b/libopkg/opkg_download.c
index 2ee97bf..77dc8e4 100644
--- a/libopkg/opkg_download.c
+++ b/libopkg/opkg_download.c
@@ -47,6 +47,7 @@
#include "file_util.h"
#include "str_util.h"
#include "opkg_defines.h"
+#include "libbb/libbb.h"
#if defined(HAVE_OPENSSL) || defined(HAVE_SSLCURL)
static void openssl_init(void);
@@ -71,7 +72,7 @@ int opkg_download(opkg_conf_t *conf, const char *src,
{
int err = 0;
- char *src_basec = strdup(src);
+ char *src_basec = xstrdup(src);
char *src_base = basename(src_basec);
char *tmp_file_location;
@@ -177,7 +178,7 @@ int opkg_download(opkg_conf_t *conf, const char *src,
static int opkg_download_cache(opkg_conf_t *conf, const char *src,
const char *dest_file_name, curl_progress_func cb, void *data)
{
- char *cache_name = strdup(src);
+ char *cache_name = xstrdup(src);
char *cache_location, *p;
int err = 0;
@@ -260,7 +261,7 @@ int opkg_prepare_url_for_install(opkg_conf_t *conf, const char *url, char **name
if (str_starts_with(url, "http://")
|| str_starts_with(url, "ftp://")) {
char *tmp_file;
- char *file_basec = strdup(url);
+ char *file_basec = xstrdup(url);
char *file_base = basename(file_basec);
sprintf_alloc(&tmp_file, "%s/%s", conf->tmp_dir, file_base);
@@ -305,7 +306,7 @@ int opkg_prepare_url_for_install(opkg_conf_t *conf, const char *url, char **name
return 0;
}
if (namep) {
- *namep = strdup(pkg->name);
+ *namep = xstrdup(pkg->name);
}
return 0;
}