summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorticktock35 <ticktock35@e8e0d7a0-c8d9-11dd-a880-a1081c7ac358>2008-12-15 00:10:48 (EST)
committer ticktock35 <ticktock35@e8e0d7a0-c8d9-11dd-a880-a1081c7ac358>2008-12-15 00:10:48 (EST)
commit922c14bca8e95e1d507ece63e0464f45dc92443c (patch)
treea3a63173a954869833ac304ce762c91872e8d437
parent290389440afaabe6c151481cd9e7a106a0dc3d92 (diff)
libopkg: add some checks for NULL strings
git-svn-id: http://opkg.googlecode.com/svn/trunk@78 e8e0d7a0-c8d9-11dd-a880-a1081c7ac358
-rw-r--r--libopkg/opkg.c21
1 files changed, 15 insertions, 6 deletions
diff --git a/libopkg/opkg.c b/libopkg/opkg.c
index f72bd78..b4aff13 100644
--- a/libopkg/opkg.c
+++ b/libopkg/opkg.c
@@ -131,14 +131,23 @@ opkg_read_config_files (opkg_t *opkg)
a->multiple_providers = c->multiple_providers;
a->verbosity = c->verbosity;
- if (a->offline_root) free (a->offline_root);
- a->offline_root = strdup (c->offline_root);
+ if (c->offline_root)
+ {
+ if (a->offline_root) free (a->offline_root);
+ a->offline_root = strdup (c->offline_root);
+ }
- if (a->offline_root_pre_script_cmd) free (a->offline_root_pre_script_cmd);
- a->offline_root_pre_script_cmd = strdup (c->offline_root_pre_script_cmd);
+ if (c->offline_root_pre_script_cmd)
+ {
+ if (a->offline_root_pre_script_cmd) free (a->offline_root_pre_script_cmd);
+ a->offline_root_pre_script_cmd = strdup (c->offline_root_pre_script_cmd);
+ }
- if (a->offline_root_post_script_cmd) free (a->offline_root_post_script_cmd);
- a->offline_root_post_script_cmd = strdup (c->offline_root_post_script_cmd);
+ if (c->offline_root_post_script_cmd)
+ {
+ if (a->offline_root_post_script_cmd) free (a->offline_root_post_script_cmd);
+ a->offline_root_post_script_cmd = strdup (c->offline_root_post_script_cmd);
+ }
/* throw away old opkg_conf and start again */
opkg_conf_deinit (opkg->conf);