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

Report: <[email protected]>

src/pl/plpgsql/src/pl_handler.c

index 266c314068648c92eaf6f793a60ffaccb69cb778..17dcecdfe54067b0c1f0445ad737c9681aedac9d 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;