Add missing check for malloc failure in plpgsql_extra_checks_check_hook().
authorTom Lane <[email protected]>
Mon, 20 Jun 2016 19:36:54 +0000 (15:36 -0400)
committerTom Lane <[email protected]>
Mon, 20 Jun 2016 19:36:54 +0000 (15:36 -0400)
Per report from Andreas Seltenreich.  Back-patch to affected versions.

Report: <[email protected]>

src/pl/plpgsql/src/pl_handler.c

index b4854ef6f0bcd6c2b9ddabd2c05fe551073be242..36868fb273738fa20067470a4d7ef729f6457a04 100644 (file)
@@ -110,6 +110,8 @@ plpgsql_extra_checks_check_hook(char **newvalue, void **extra, GucSource source)
    }
 
    myextra = (int *) malloc(sizeof(int));
+   if (!myextra)
+       return false;
    *myextra = extrachecks;
    *extra = (void *) myextra;