diff options
author | Robert Foss <robert.foss@collabora.com> | 2017-01-18 10:15:24 -0500 |
---|---|---|
committer | Robert Foss <robert.foss@collabora.com> | 2017-01-20 09:29:19 -0500 |
commit | 725edb3b432c208230f1f4055b81f69da9a61ca1 (patch) | |
tree | 36ee009627f03f8a710752f3a698306bb62e49c5 /lib/igt_kms.c | |
parent | 8d14370a3954a2691398f40e3a20aa0adcc8cd14 (diff) |
lib/igt_kms: Check memory allocations for failures
Add missing descriptive igt_assert_t calls to calloc'd memory.
Signed-off-by: Robert Foss <robert.foss@collabora.com>
Reviewed-by: Petri Latvala <petri.latvala@intel.com>
Diffstat (limited to 'lib/igt_kms.c')
-rw-r--r-- | lib/igt_kms.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/igt_kms.c b/lib/igt_kms.c index 2c5a6e89..8c10568a 100644 --- a/lib/igt_kms.c +++ b/lib/igt_kms.c @@ -1107,6 +1107,7 @@ void kmstest_edid_add_3d(const unsigned char *edid, size_t length, *new_length = length + 128; new_edid = calloc(*new_length, sizeof(char)); + igt_assert_f(new_edid, "Failed to allocate %zu bytes for edid\n", sizeof(new_length)); memcpy(new_edid, edid, length); *new_edid_ptr = new_edid; @@ -1506,6 +1507,7 @@ void igt_display_init(igt_display_t *display, int drm_fd) */ display->n_pipes = resources->count_crtcs; display->pipes = calloc(sizeof(igt_pipe_t), display->n_pipes); + igt_assert_f(display->pipes, "Failed to allocate memory for %d pipes\n", display->n_pipes); drmSetClientCap(drm_fd, DRM_CLIENT_CAP_UNIVERSAL_PLANES, 1); is_atomic = drmSetClientCap(drm_fd, DRM_CLIENT_CAP_ATOMIC, 1); @@ -1650,7 +1652,7 @@ void igt_display_init(igt_display_t *display, int drm_fd) */ display->n_outputs = resources->count_connectors; display->outputs = calloc(display->n_outputs, sizeof(igt_output_t)); - igt_assert(display->outputs); + igt_assert_f(display->outputs, "Failed to allocate memory for %d outputs\n", display->n_outputs); for (i = 0; i < display->n_outputs; i++) { igt_output_t *output = &display->outputs[i]; |