diff --git a/src/browser.c b/src/browser.c
index d13dac80ed78df426da0c1808c8bf668d940415b..3a84d9f39b9af7357261ba5682ba6f8b8712710b 100644
--- a/src/browser.c
+++ b/src/browser.c
@@ -152,7 +152,7 @@ static void browse_draw_item(struct dir *n, int row) {
 void browse_draw() {
   struct dir *t;
   char fmtsize[9], *tmp;
-  int selected, i;
+  int selected = 0, i;
 
   erase();
   t = dirlist_get(0);
diff --git a/src/dir_common.c b/src/dir_common.c
index c4ff81937a463d9a4bbd9bb7ca7e5ddcd72b077e..fecaa233ef9b74b15eea54cbae163452d584fd7e 100644
--- a/src/dir_common.c
+++ b/src/dir_common.c
@@ -119,9 +119,9 @@ struct dir *dir_createstruct(const char *name) {
 
 static void draw_progress() {
   static const char antext[] = "Scanning...";
-  static int anpos = 0;
+  static size_t anpos = 0;
   char ani[20] = {};
-  int i;
+  size_t i;
   int width = wincols-5;
 
   nccreate(10, width, "Scanning...");
diff --git a/src/dir_scan.c b/src/dir_scan.c
index a511275a7b8704e7a2af01b9e8cbcdb1a5a4a579..e7ee5d8170608ffb07ae480c03587ee9558bc7b8 100644
--- a/src/dir_scan.c
+++ b/src/dir_scan.c
@@ -248,8 +248,10 @@ int dir_scan_process() {
     dir_seterr("Error reading directory: %s", strerror(errno));
 
   /* Special case: empty directory = error */
-  if(!dir_fatalerr && !*dir)
+  if(!dir_fatalerr && !*dir) {
     dir_seterr("Directory empty");
+    free(dir);
+  }
 
   if(!dir_fatalerr) {
     curdev = fs.st_dev;
diff --git a/src/path.c b/src/path.c
index 17b1e39d0f7e50af71f1436bd095d501064c4bb9..1c6c5872b36c6295dfea2a5d53baae0e88c505a6 100644
--- a/src/path.c
+++ b/src/path.c
@@ -127,7 +127,7 @@ static char *path_absolute(const char *path) {
 /* NOTE: cwd and the memory cur points to are unreliable after calling this function */
 static char *path_real_rec(char *cur, int *links) {
   int i, n, tmpl, lnkl = 0;
-  char **arr, *tmp, *lnk, *ret = NULL;
+  char **arr, *tmp, *lnk = NULL, *ret = NULL;
 
   tmpl = strlen(cur)+1;
   tmp = malloc(tmpl);