memory leak and missing error check issues fix 84/226184/1 accepted/tizen_6.0_unified accepted/tizen_6.0_unified_hotfix tizen_6.0_hotfix accepted/tizen/6.0/unified/20201030.124137 accepted/tizen/6.0/unified/hotfix/20201103.052254 accepted/tizen/unified/20200228.123707 submit/tizen/20200227.113923 submit/tizen_6.0/20201029.205101 submit/tizen_6.0_hotfix/20201102.192501 submit/tizen_6.0_hotfix/20201103.114801 tizen_6.0.m2_release
authorsrinivasa.m <srinivasa.m@samsung.com>
Thu, 27 Feb 2020 09:48:31 +0000 (15:18 +0530)
committersrinivasa.m <srinivasa.m@samsung.com>
Thu, 27 Feb 2020 09:48:31 +0000 (15:18 +0530)
Change-Id: I72660a30d7efdcf8a6a090eda76862d841145248
Signed-off-by: srinivasa.m <srinivasa.m@samsung.com>
server/fido_app_id_handler.c
server/fido_server.c

index c9cf93a..524d17a 100755 (executable)
@@ -327,11 +327,16 @@ __b64_encode(unsigned char *input, int ip_len)
        RET_IF_FAIL(input != NULL, NULL);
        RET_IF_FAIL(ip_len > 0, NULL);
 
-       unsigned char *output = calloc(ip_len * 1.5, sizeof(char));
-
+       unsigned char *output = NULL;
        BIO *bmem = NULL;
        BIO *b64 = NULL;
        BUF_MEM *bptr = NULL;
+
+       output = calloc(ip_len * 1.5, sizeof(char));
+       if (output == NULL) {
+               _ERR("memory allocation failed \n");
+               return NULL;
+       }
        b64 = BIO_new(BIO_f_base64());
        if (b64 == NULL) {
                _ERR("BIO_new failed \n");
index d872905..6f41dc0 100755 (executable)
@@ -547,6 +547,8 @@ __copy_convert_uaf_trans_list(GList *uaf_tr_list)
                if (uaf_tr->display_charac != NULL) {
                        asm_tr->display_charac = calloc(1, sizeof(_fido_asm_display_png_characteristics_descriptor_t));
                        if (asm_tr->display_charac == NULL) {
+                               SAFE_DELETE(asm_tr->content);
+                               SAFE_DELETE(asm_tr->content_type);
                                SAFE_DELETE(asm_tr);
                                return NULL;
                        }
@@ -566,6 +568,8 @@ __copy_convert_uaf_trans_list(GList *uaf_tr_list)
 
                                        fido_rgb_pallette_entry_s *asm_plte_entry = calloc(1, sizeof(fido_rgb_pallette_entry_s));
                                        if (asm_plte_entry == NULL) {
+                                               SAFE_DELETE(asm_tr->content);
+                                               SAFE_DELETE(asm_tr->content_type);
                                                SAFE_DELETE(asm_tr->display_charac);
                                                SAFE_DELETE(asm_tr);
                                                return NULL;