r4384 - trunk/src/target/opkg/libopkg

thomas at sita.openmoko.org thomas at sita.openmoko.org
Mon Apr 21 16:33:34 CEST 2008


Author: thomas
Date: 2008-04-21 16:33:34 +0200 (Mon, 21 Apr 2008)
New Revision: 4384

Modified:
   trunk/src/target/opkg/libopkg/opkg.c
Log:
libopkg: add some checks for NULL strings


Modified: trunk/src/target/opkg/libopkg/opkg.c
===================================================================
--- trunk/src/target/opkg/libopkg/opkg.c	2008-04-21 14:20:32 UTC (rev 4383)
+++ trunk/src/target/opkg/libopkg/opkg.c	2008-04-21 14:33:34 UTC (rev 4384)
@@ -131,14 +131,23 @@
   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);





More information about the commitlog mailing list