Now that the shared library name can be adjusted in the library test,
authorBruce Momjian <bruce@momjian.us>
Wed, 25 Jan 2012 14:35:17 +0000 (09:35 -0500)
committerBruce Momjian <bruce@momjian.us>
Wed, 25 Jan 2012 14:35:17 +0000 (09:35 -0500)
have pg_upgrade allocate a maximum fixed size buffer for testing the
library file name, rather than base the allocation on the library name.

Backpatch to 9.1.

contrib/pg_upgrade/function.c

index 988486b4503015d0ba05d614a74ba8001e689f0e..267f29143db34b3d404e34f9b05598e5953bc777 100644 (file)
@@ -225,7 +225,7 @@ check_loadable_libraries(void)
    {
        char       *lib = os_info.libraries[libnum];
        int         llen = strlen(lib);
-       char       *cmd = (char *) pg_malloc(8 + 2 * llen + 1);
+       char        cmd[7 + 2 * MAXPGPATH + 1];
        PGresult   *res;
 
        /*
@@ -266,7 +266,6 @@ check_loadable_libraries(void)
        }
 
        PQclear(res);
-       pg_free(cmd);
    }
 
    PQfinish(conn);