Release version 0.12.10
[platform/core/appfw/pkgmgr-info.git] / src / pkgmgrinfo_db.c
index 0075ff1..e382bf5 100644 (file)
@@ -1,3 +1,4 @@
+#define _GNU_SOURCE
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
@@ -58,6 +59,7 @@ static int _mkdir_for_user(const char* dir, uid_t uid, gid_t gid)
                if (fd == -1) {
                        _LOGE("FAIL : open %s : %s", dir,
                                        strerror_r(errno, buf, sizeof(buf)));
+                       free(fullpath);
                        return -1;
                }
                ret = fstat(fd, &sb);
@@ -65,11 +67,13 @@ static int _mkdir_for_user(const char* dir, uid_t uid, gid_t gid)
                        _LOGE("FAIL : fstat %s : %s", dir,
                                        strerror_r(errno, buf, sizeof(buf)));
                        close(fd);
+                       free(fullpath);
                        return -1;
                }
                if (S_ISLNK(sb.st_mode)) {
                        _LOGE("FAIL : %s is symlink!", dir);
                        close(fd);
+                       free(fullpath);
                        return -1;
                }
                ret = fchown(fd, uid, gid);
@@ -77,6 +81,7 @@ static int _mkdir_for_user(const char* dir, uid_t uid, gid_t gid)
                        _LOGE("FAIL : fchown %s %d.%d, because %s", dir, uid,
                                        gid, strerror_r(errno, buf, sizeof(buf)));
                        close(fd);
+                       free(fullpath);
                        return -1;
                }
                close(fd);