opkg: fix invalid free triggered by 011-old-config-location.patch and replace 012...
authorJo-Philipp Wich <jow@openwrt.org>
Mon, 21 Dec 2009 15:09:08 +0000 (15:09 +0000)
committerJo-Philipp Wich <jow@openwrt.org>
Mon, 21 Dec 2009 15:09:08 +0000 (15:09 +0000)
SVN-Revision: 18879

package/opkg/patches/011-old-config-location.patch
package/opkg/patches/012-cleanup-tmpdir.patch

index 40d0b7566506258efda659b9ee69a38e6113e488..518993b254ae2bc13347ab97c887073a19beb86b 100644 (file)
@@ -7,7 +7,7 @@
 -    
 +
 +      if(!conf->conf_file)
-+              conf->conf_file = "/etc/opkg.conf";
++              conf->conf_file = xstrdup("/etc/opkg.conf");
 +
        if (parse_err)
                return parse_err;
index f6d5e8732d90730940c957120dbe5d4f0300fd2a..d794a070e1cf77c16e053c8d1522ebab5289d920 100644 (file)
@@ -1,12 +1,35 @@
 --- a/src/opkg-cl.c
 +++ b/src/opkg-cl.c
-@@ -333,6 +333,9 @@
+@@ -263,7 +263,7 @@
+ int
+ main(int argc, char *argv[])
+ {
+-      int opts;
++      int opts, err = -1;
+       char *cmd_name;
+       opkg_cmd_t *cmd;
+       int nocheckfordirorfile = 0;
+@@ -327,15 +327,8 @@
+               usage();
+       }
+-      if (opkg_cmd_exec(cmd, argc - opts, (const char **) (argv + opts)))
+-              goto err2;
++      err = opkg_cmd_exec(cmd, argc - opts, (const char **) (argv + opts));
+-      print_error_list();
+-      free_error_list();
+-
+-      return 0;
+-
+-err2:
+ #ifdef HAVE_CURL
+       opkg_curl_cleanup();
+ #endif
+@@ -346,5 +339,5 @@
        print_error_list();
        free_error_list();
  
-+      if( conf->tmp_dir )
-+              rm_r(conf->tmp_dir);
-+
-       return 0;
- err2:
+-      return -1;
++      return err;
+ }