summaryrefslogtreecommitdiffstats
path: root/libopkg/opkg_install.c
diff options
context:
space:
mode:
authorgraham.gower <graham.gower@e8e0d7a0-c8d9-11dd-a880-a1081c7ac358>2009-11-03 22:14:39 (EST)
committer graham.gower <graham.gower@e8e0d7a0-c8d9-11dd-a880-a1081c7ac358>2009-11-03 22:14:39 (EST)
commitedf1b1964b565726a0b0f730b109e4491c7929b9 (patch)
tree1b44b552451f0dd57c7da2b547e79c9df6943348 /libopkg/opkg_install.c
parent923f73d334e7969a814d09cbba3a2a416ac7b0dc (diff)
Remove some strdup abuse.
git-svn-id: http://opkg.googlecode.com/svn/trunk@254 e8e0d7a0-c8d9-11dd-a880-a1081c7ac358
Diffstat (limited to 'libopkg/opkg_install.c')
-rw-r--r--libopkg/opkg_install.c19
1 files changed, 10 insertions, 9 deletions
diff --git a/libopkg/opkg_install.c b/libopkg/opkg_install.c
index 82749d5..e726867 100644
--- a/libopkg/opkg_install.c
+++ b/libopkg/opkg_install.c
@@ -870,7 +870,7 @@ int opkg_install_pkg(opkg_conf_t *conf, pkg_t *pkg, int from_upgrade)
if (pkg->md5sum)
{
file_md5 = file_md5sum_alloc(pkg->local_filename);
- if (strcmp(file_md5, pkg->md5sum))
+ if (file_md5 && strcmp(file_md5, pkg->md5sum))
{
opkg_message(conf, OPKG_ERROR,
"Package %s md5sum mismatch. Either the opkg or the package index are corrupt. Try 'opkg update'.\n",
@@ -878,7 +878,8 @@ int opkg_install_pkg(opkg_conf_t *conf, pkg_t *pkg, int from_upgrade)
free(file_md5);
return OPKG_INSTALL_ERR_MD5;
}
- free(file_md5);
+ if (file_md5)
+ free(file_md5);
}
#ifdef HAVE_SHA256
@@ -886,7 +887,7 @@ int opkg_install_pkg(opkg_conf_t *conf, pkg_t *pkg, int from_upgrade)
if(pkg->sha256sum)
{
file_sha256 = file_sha256sum_alloc(pkg->local_filename);
- if (strcmp(file_sha256, pkg->sha256sum))
+ if (file_sha256 && strcmp(file_sha256, pkg->sha256sum))
{
opkg_message(conf, OPKG_ERROR,
"Package %s sha256sum mismatch. Either the opkg or the package index are corrupt. Try 'opkg update'.\n",
@@ -894,7 +895,8 @@ int opkg_install_pkg(opkg_conf_t *conf, pkg_t *pkg, int from_upgrade)
free(file_sha256);
return OPKG_INSTALL_ERR_SHA256;
}
- free(file_sha256);
+ if (file_sha256)
+ free(file_sha256);
}
#endif
@@ -1585,10 +1587,8 @@ static int resolve_conffiles(opkg_conf_t *conf, pkg_t *pkg)
conffile_list_elt_t *iter;
conffile_t *cf;
char *cf_backup;
+ char *md5sum;
- char *md5sum;
-
-
if (conf->noaction) return 0;
for (iter = nv_pair_list_first(&pkg->conffiles); iter; iter = nv_pair_list_next(&pkg->conffiles, iter)) {
@@ -1612,7 +1612,7 @@ static int resolve_conffiles(opkg_conf_t *conf, pkg_t *pkg)
if (file_exists(cf_backup)) {
/* Let's compute md5 to test if files are changed */
md5sum = file_md5sum_alloc(cf_backup);
- if (strcmp( cf->value,md5sum) != 0 ) {
+ if (md5sum && cf->value && strcmp(cf->value,md5sum) != 0 ) {
if (conf->force_maintainer) {
opkg_message(conf, OPKG_NOTICE, "Conffile %s using maintainer's setting.\n", cf_backup);
} else if (conf->force_defaults
@@ -1621,7 +1621,8 @@ static int resolve_conffiles(opkg_conf_t *conf, pkg_t *pkg)
}
}
unlink(cf_backup);
- free(md5sum);
+ if (md5sum)
+ free(md5sum);
}
free(cf_backup);