Remove out of memory related code by using glib APIs
[platform/core/multimedia/libmm-utility.git] / imgp / test / mm_util_imgp_testsuite.c
index 7f1b654..7589011 100644 (file)
@@ -96,13 +96,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 = g_malloc0(len);
        *length = fread(*data, 1, (size_t)len, fp);
        if (*length != len) {
                fprintf(stderr, "\t[IMGP_testsuite] fread failed \n");
@@ -110,11 +104,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[IMGP_testsuite] %s %zu read DONE\n", path, *length);