diff --git a/NEWS b/NEWS
index fe5f67570334a143b2f9d3523215997692211f7f..88c3b7f45f9bb00c23933bd042ca1bf1855aa446 100644
--- a/NEWS
+++ b/NEWS
@@ -13,6 +13,7 @@ documents those changes that are of interest to users and administrators.
  -- When running the "scontrol top" command, make sure that all of the user's
     jobs have a priority that is lower than the selected job. Previous logic
     would permit other jobs with equal priority (no jobs with higher priority).
+ -- Fix perl api so we always get an allocation when calling Slurm::new().
 
 * Changes in Slurm 17.02.2
 ==========================
diff --git a/contribs/perlapi/libslurm/perl/Slurm.xs b/contribs/perlapi/libslurm/perl/Slurm.xs
index 7bda2050d6a359d3b80baf19fa9eecdda67225e1..27c702ab60c3d15b1c3273c1cff909e8e2470f7f 100644
--- a/contribs/perlapi/libslurm/perl/Slurm.xs
+++ b/contribs/perlapi/libslurm/perl/Slurm.xs
@@ -30,7 +30,12 @@ static struct slurm default_slurm_object;
 static slurm_t
 new_slurm(void)
 {
-	return xmalloc(sizeof(struct slurm));
+	int size = sizeof(struct slurm);
+	if (size == 0) {
+		/* Avoid returning NULL, which causes the perl APIs to fail */
+		size = 1;
+	}
+	return xmalloc(size);
 }
 
 static void