Remove compile warning messages
[platform/core/appfw/pkgmgr-info.git] / src / pkgmgrinfo_pkginfo.c
index dc3048a..4235b42 100644 (file)
@@ -368,6 +368,7 @@ static int _get_filtered_query(pkgmgrinfo_filter_x *filter,
                const char *locale, uid_t uid, char **query, GList **bind_params)
 {
        int joined = 0;
+       int size;
        char buf[MAX_QUERY_LEN] = { '\0' };
        char buf2[MAX_QUERY_LEN] = { '\0' };
        char *condition = NULL;
@@ -396,11 +397,12 @@ static int _get_filtered_query(pkgmgrinfo_filter_x *filter,
        }
        if (joined & E_PMINFO_PKGINFO_JOIN_PRIVILEGE_INFO)
                strncat(buf2, join_privilege_info, sizeof(buf2) - strlen(buf2) - 1);
-       strncat(buf2, buf, sizeof(buf2) - strlen(buf2) - 1);
 
-       *query = strdup(buf2);
+       size = strlen(buf2) + strlen(buf) + 1;
+       *query = (char *)calloc(1, size);
        if (*query == NULL)
                return PMINFO_R_ERROR;
+       snprintf(*query, size, "%s%s", buf2, buf);
 
        return PMINFO_R_OK;
 }