[PATCH] Fix pseudo resource leak in case another process is running

Wald Commits scm-commit at wald.intevation.org
Wed Oct 15 17:59:07 CEST 2014


# HG changeset patch
# User Andre Heinecke <andre.heinecke at intevation.de>
# Date 1413380427 -7200
# Node ID 5d7b1650de1f9d63acd3d6abd91178f479eedd48
# Parent  8362e30f7b556a8d4f9d0af94affa6a816b1a6d7
Fix pseudo resource leak in case another process is running.

    Pseudo because this code path leads to an immediate exit.

diff -r 8362e30f7b55 -r 5d7b1650de1f common/linuxlockfile.c
--- a/common/linuxlockfile.c	Wed Oct 15 14:19:46 2014 +0200
+++ b/common/linuxlockfile.c	Wed Oct 15 15:40:27 2014 +0200
@@ -42,6 +42,7 @@
            if (f)
              {
                bytes_read = fread(oldpid, 1, sizeof(oldpid), f);
+               fclose(f);
                if (bytes_read)
                  {
                    char *oldPath,
@@ -67,7 +68,6 @@
                        xfree(newPath);
                      }
                  }
-               fclose(f);
              }
 
            ftruncate(fd, 0);


More information about the Trustbridge-commits mailing list