diff --git a/src/extra-tools/execl-envfile.c b/src/extra-tools/execl-envfile.c
index 68c6f4af5140ee03aae4d7656117fadb3612c28c..d106b2763aecd8edf4c61054e65c75061659f556 100644
--- a/src/extra-tools/execl-envfile.c
+++ b/src/extra-tools/execl-envfile.c
@@ -128,6 +128,12 @@ void parse_env_var(stralloc *result, char const *line)
     memcpy(mkey,line,spos - 1) ;
     mkey[spos - 1] = 0 ;
 
+    if (!line[spos]) {
+
+        stralloc_free(&subs) ;
+        return ;
+    }
+
     if (!auto_stra(&subs, line + spos))
         log_die_nomem("stralloc") ;