]> git.saurik.com Git - cycript.git/commitdiff
With -p on all platforms, we can't use asprintf(). master
authorJay Freeman (saurik) <saurik@saurik.com>
Tue, 6 Sep 2016 03:51:38 +0000 (20:51 -0700)
committerJay Freeman (saurik) <saurik@saurik.com>
Tue, 6 Sep 2016 03:51:38 +0000 (20:51 -0700)
Console.cpp

index 7f68ecd3473b13c92073c50316b25add601f0513..424c97fdc83f56130c696545322c5ece97dcd403 100644 (file)
@@ -965,9 +965,8 @@ int Main(int argc, char * const argv[], char const * const envp[]) {
                 if (optarg + size != end) {
                     // XXX: arg needs to be escaped in some horrendous way of doom
                     // XXX: this is a memory leak now because I just don't care enough
-                    char *command;
-                    int writ(asprintf(&command, "ps axc|sed -e '/^ *[0-9]/{s/^ *\\([0-9]*\\)\\( *[^ ]*\\)\\{3\\} *-*\\([^ ]*\\)/\\3 \\1/;/^%s /{s/^[^ ]* //;q;};};d'", optarg));
-                    _assert(writ != -1);
+                    CYPool pool;
+                    char *command(pool.sprintf(strlen(optarg) + 256, "ps axc|sed -e '/^ *[0-9]/{s/^ *\\([0-9]*\\)\\( *[^ ]*\\)\\{3\\} *-*\\([^ ]*\\)/\\3 \\1/;/^%s /{s/^[^ ]* //;q;};};d'", optarg));
 
                     if (FILE *pids = popen(command, "r")) {
                         char value[32];