systemd-user-helper: fix handle leak 36/88636/1 accepted/tizen/common/20160921.161650 accepted/tizen/ivi/20160921.081157 accepted/tizen/mobile/20160921.081208 accepted/tizen/tv/20160921.081153 accepted/tizen/wearable/20160921.081203 submit/tizen/20160921.014304
authorSunmin Lee <sunm.lee@samsung.com>
Tue, 20 Sep 2016 05:25:05 +0000 (14:25 +0900)
committerSunmin Lee <sunm.lee@samsung.com>
Tue, 20 Sep 2016 05:25:05 +0000 (14:25 +0900)
Fix handle leaks at systemd-user-helper.

Change-Id: Ida4fe08c053379b8d27591844a4eae37a1476608
Signed-off-by: Sunmin Lee <sunm.lee@samsung.com>
src/systemd-user-helper/systemd-user-helper.c

index 2012e9d..2bffce6 100644 (file)
@@ -38,6 +38,7 @@
                sym = dlsym(handle, name); \
                if (!sym) { \
                        fprintf(stderr, "dlsym %s error\n", name); \
+                       dlclose(handle); \
                        return -1; \
                } \
        } while (0);
@@ -159,9 +160,11 @@ static int wait_condition(void)
        r = wait_mount_user();
        if (r < 0) {
                fprintf(stderr, "wait_mout_user failed\n");
+               dlclose(h);
                return r;
        }
 
+       dlclose(h);
        return 0;
 }