summaryrefslogtreecommitdiffstats
path: root/libopkg
diff options
context:
space:
mode:
authorgraham.gower <graham.gower@e8e0d7a0-c8d9-11dd-a880-a1081c7ac358>2009-11-03 22:15:09 (EST)
committer graham.gower <graham.gower@e8e0d7a0-c8d9-11dd-a880-a1081c7ac358>2009-11-03 22:15:09 (EST)
commit7dff5be677598f2f93c5c11978f28f650852c4e2 (patch)
tree2d3ed3fbd60ef33c6e2315dfb282f713daf7e700 /libopkg
parent11af232b19155c76002b5ca1f2b0e89d75699d3a (diff)
s/strndup/xstrndup/ - check memory allocations for failure.
git-svn-id: http://opkg.googlecode.com/svn/trunk@256 e8e0d7a0-c8d9-11dd-a880-a1081c7ac358
Diffstat (limited to 'libopkg')
-rw-r--r--libopkg/opkg.c2
-rw-r--r--libopkg/opkg_conf.c14
2 files changed, 8 insertions, 8 deletions
diff --git a/libopkg/opkg.c b/libopkg/opkg.c
index 9cbbe90..4375440 100644
--- a/libopkg/opkg.c
+++ b/libopkg/opkg.c
@@ -1043,7 +1043,7 @@ int opkg_repository_accessibility_check(opkg_t *opkg)
{
if (strstr(((pkg_src_t *)iter->data)->value, "://") &&
index(strstr(((pkg_src_t *)iter->data)->value, "://") + 3, '/'))
- stmp = strndup(((pkg_src_t *)iter->data)->value,
+ stmp = xstrndup(((pkg_src_t *)iter->data)->value,
(index(strstr(((pkg_src_t *)iter->data)->value, "://") + 3, '/') - ((pkg_src_t *)iter->data)->value)*sizeof(char));
else
diff --git a/libopkg/opkg_conf.c b/libopkg/opkg_conf.c
index 57c670e..a273c30 100644
--- a/libopkg/opkg_conf.c
+++ b/libopkg/opkg_conf.c
@@ -568,29 +568,29 @@ static int opkg_conf_parse_file(opkg_conf_t *conf, const char *filename,
/* This has to be so ugly to deal with optional quotation marks */
if (regmatch[2].rm_so > 0) {
- type = strndup(line + regmatch[2].rm_so,
+ type = xstrndup(line + regmatch[2].rm_so,
regmatch[2].rm_eo - regmatch[2].rm_so);
} else {
- type = strndup(line + regmatch[3].rm_so,
+ type = xstrndup(line + regmatch[3].rm_so,
regmatch[3].rm_eo - regmatch[3].rm_so);
}
if (regmatch[5].rm_so > 0) {
- name = strndup(line + regmatch[5].rm_so,
+ name = xstrndup(line + regmatch[5].rm_so,
regmatch[5].rm_eo - regmatch[5].rm_so);
} else {
- name = strndup(line + regmatch[6].rm_so,
+ name = xstrndup(line + regmatch[6].rm_so,
regmatch[6].rm_eo - regmatch[6].rm_so);
}
if (regmatch[8].rm_so > 0) {
- value = strndup(line + regmatch[8].rm_so,
+ value = xstrndup(line + regmatch[8].rm_so,
regmatch[8].rm_eo - regmatch[8].rm_so);
} else {
- value = strndup(line + regmatch[9].rm_so,
+ value = xstrndup(line + regmatch[9].rm_so,
regmatch[9].rm_eo - regmatch[9].rm_so);
}
extra = NULL;
if (regmatch[11].rm_so > 0) {
- extra = strndup (line + regmatch[11].rm_so,
+ extra = xstrndup (line + regmatch[11].rm_so,
regmatch[11].rm_eo - regmatch[11].rm_so);
}