summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSung-jae Park <nicesj.park@samsung.com>2013-12-07 00:51:41 +0900
committerSung-jae Park <nicesj.park@samsung.com>2013-12-07 00:51:41 +0900
commitd1f436a07c78e7ceb2631acd5519409f8ba90117 (patch)
tree96c318fd1f7e8cf0cc2a00ce000734fc7a0e4936
parent0247016ee1945a34033c9388c2af882cd5670744 (diff)
downloadshortcut-d1f436a07c78e7ceb2631acd5519409f8ba90117.tar.gz
shortcut-d1f436a07c78e7ceb2631acd5519409f8ba90117.tar.bz2
shortcut-d1f436a07c78e7ceb2631acd5519409f8ba90117.zip
Fix the prevent issue
Change-Id: If0a4600e4890780c540cab5769b254cde5f23302
-rw-r--r--lib/src/main.c9
-rw-r--r--packaging/libshortcut.spec2
2 files changed, 9 insertions, 2 deletions
diff --git a/lib/src/main.c b/lib/src/main.c
index d950889..a91ffbb 100644
--- a/lib/src/main.c
+++ b/lib/src/main.c
@@ -650,7 +650,7 @@ static inline int get_i18n_name(const char *lang, int id, char **name, char **ic
static const char *query = "SELECT name, icon FROM shortcut_name WHERE id = ? AND lang = ? COLLATE NOCASE";
const unsigned char *_name;
const unsigned char *_icon;
- int ret;
+ int ret = 0;
int status;
status = sqlite3_prepare_v2(s_info.handle, query, -1, &stmt, NULL);
@@ -686,6 +686,8 @@ static inline int get_i18n_name(const char *lang, int id, char **name, char **ic
*name = strdup((const char *)_name);
if (!*name) {
ErrPrint("strdup: %s\n", strerror(errno));
+ ret = -ENOMEM;
+ goto out;
}
} else {
*name = NULL;
@@ -698,6 +700,11 @@ static inline int get_i18n_name(const char *lang, int id, char **name, char **ic
*icon = strdup((const char *)_icon);
if (!*icon) {
ErrPrint("strdup: %s\n", strerror(errno));
+ ret = -ENOMEM;
+ if (name && *name) {
+ free(*name);
+ }
+ goto out;
}
} else {
*icon = NULL;
diff --git a/packaging/libshortcut.spec b/packaging/libshortcut.spec
index 63103c8..19ee302 100644
--- a/packaging/libshortcut.spec
+++ b/packaging/libshortcut.spec
@@ -1,6 +1,6 @@
Name: libshortcut
Summary: Shortcut add feature supporting library
-Version: 0.6.10
+Version: 0.6.11
Release: 0
Group: HomeTF/Framework
License: Apache