diff --git a/wmake/src/wmkdep.l b/wmake/src/wmkdep.l
index 166a219..b159ee2 100644
--- a/wmake/src/wmkdep.l
+++ b/wmake/src/wmkdep.l
@@ -144,7 +144,7 @@ int main(int argc, char* argv[])
     }
     else
     {
-        sourcePath = (char*)malloc(basePos - sourceFile + 1);
+        sourcePath = (char*)calloc(basePos - sourceFile + 1, sizeof(char*));
         strncpy(sourcePath, sourceFile, basePos - sourceFile);
     }
 
