diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2008-12-20 19:17:28 +0000 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2009-01-02 09:53:27 +0000 |
commit | 8d23c3a6c2ab0ae168afb695e2b8c5f121ed2be3 (patch) | |
tree | 73b615074f42dfd3f18e3d3f1852b933494ca407 /src/cairo-quartz-font.c | |
parent | 9c9ed8f0b5ce8bc3036dcb0bf841ffaa24797cfa (diff) | |
download | cairo-8d23c3a6c2ab0ae168afb695e2b8c5f121ed2be3.tar.gz |
[quartz] Delay allocation of string until after guard.
Fixes a memory leak should we bail due to the version of Quartz being
insufficient.
Reported: http://bugs.freedesktop.org/show_bug.cgi?id=19209.
Diffstat (limited to 'src/cairo-quartz-font.c')
-rw-r--r-- | src/cairo-quartz-font.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/cairo-quartz-font.c b/src/cairo-quartz-font.c index 63f050ce5..a800cb443 100644 --- a/src/cairo-quartz-font.c +++ b/src/cairo-quartz-font.c @@ -135,8 +135,8 @@ static cairo_status_t _cairo_quartz_font_face_create_for_toy (cairo_toy_font_face_t *toy_face, cairo_font_face_t **font_face) { - const char *family = toy_face->family; - char *full_name = malloc(strlen(family) + 64); // give us a bit of room to tack on Bold, Oblique, etc. + const char *family; + char *full_name; CFStringRef cgFontName = NULL; CGFontRef cgFont = NULL; int loop; @@ -145,6 +145,8 @@ _cairo_quartz_font_face_create_for_toy (cairo_toy_font_face_t *toy_face, if (! _cairo_quartz_font_symbols_present) return _cairo_error (CAIRO_STATUS_NO_MEMORY); + family = toy_face->family; + full_name = malloc (strlen (family) + 64); // give us a bit of room to tack on Bold, Oblique, etc. /* handle CSS-ish faces */ if (!strcmp(family, "serif") || !strcmp(family, "Times Roman")) family = "Times"; |