Remove out of memory related code by using glib APIs
[platform/core/multimedia/libmm-utility.git] / png / test / mm_util_png_testsuite.c
index a2b1823..c484a15 100644 (file)
@@ -100,13 +100,7 @@ static gboolean _read_file(char *path, void **data, size_t *length)
        }
 
        rewind(fp);
-       *data = (void *)calloc(1, len);
-       if (*data == NULL) {
-               fprintf(stderr, "\tmemory allocation failed \n");
-               fclose(fp);
-               return FALSE;
-       }
-
+       *data = (void *)g_malloc0(len);
        *length = fread(*data, 1, (size_t)len, fp);
        if (*length != len) {
                fprintf(stderr, "\t[PNG_testsuite] fread failed \n");
@@ -114,11 +108,6 @@ static gboolean _read_file(char *path, void **data, size_t *length)
 
        fclose(fp);
 
-       if (*data == NULL) {
-               *length = 0;
-               return FALSE;
-       }
-
        *length = (size_t)len;
 
        fprintf(stderr, "\t[PNG_testsuite] %s %zu read DONE\n", path, *length);