diff options
Diffstat (limited to 'src/xine-engine/osd.c')
-rw-r--r-- | src/xine-engine/osd.c | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/src/xine-engine/osd.c b/src/xine-engine/osd.c index 907b20c8e..480a3f380 100644 --- a/src/xine-engine/osd.c +++ b/src/xine-engine/osd.c @@ -243,7 +243,7 @@ static osd_object_t *osd_new_object (osd_renderer_t *this, int width, int height pthread_mutex_lock (&this->osd_mutex); - osd = xine_xmalloc( sizeof(osd_object_t) ); + osd = calloc(1, sizeof(osd_object_t)); osd->renderer = this; osd->next = this->osds; this->osds = osd; @@ -764,7 +764,7 @@ static int osd_renderer_load_font(osd_renderer_t *this, char *filename) { /* fixme: check for all read errors... */ if( (fp = gzopen(filename,"rb")) != NULL ) { - font = xine_xmalloc( sizeof(osd_font_t) ); + font = calloc(1, sizeof(osd_font_t)); gzread(fp, font->name, sizeof(font->name) ); font->version = gzread_i16(fp); @@ -999,7 +999,7 @@ static int osd_lookup_xdg( osd_object_t *osd, const char *const fontname ) { static int osd_set_font_freetype2( osd_object_t *osd, const char *fontname, int size ) { if (!osd->ft2) { - osd->ft2 = xine_xmalloc(sizeof(osd_ft2context_t)); + osd->ft2 = calloc(1, sizeof(osd_ft2context_t)); if(FT_Init_FreeType( &osd->ft2->library )) { xprintf(osd->renderer->stream->xine, XINE_VERBOSITY_LOG, _("osd: cannot initialize ft2 library\n")); @@ -1542,10 +1542,9 @@ static void osd_preload_fonts (osd_renderer_t *this, char *path) { if( p ) { osd_font_t *font; - char *pathname; *p++ = '\0'; - font = xine_xmalloc( sizeof(osd_font_t) ); + font = calloc(1, sizeof(osd_font_t) ); strncpy(font->name, s, sizeof(font->name)); font->size = atoi(p); @@ -1553,9 +1552,7 @@ static void osd_preload_fonts (osd_renderer_t *this, char *path) { lprintf("font '%s' size %d is preloaded\n", font->name, font->size); - pathname = (char *) xine_xmalloc(strlen(path) + strlen(entry->d_name) + 2); - sprintf (pathname, "%s/%s", path, entry->d_name); - font->filename = pathname; + asprintf (&font->filename, "%s/%s", path, entry->d_name); font->next = this->fonts; this->fonts = font; @@ -1710,9 +1707,9 @@ osd_renderer_t *_x_osd_renderer_init( xine_stream_t *stream ) { osd_renderer_t *this; - this = xine_xmalloc(sizeof(osd_renderer_t)); + this = calloc(1, sizeof(osd_renderer_t)); this->stream = stream; - this->event.object.overlay = xine_xmalloc( sizeof(vo_overlay_t) ); + this->event.object.overlay = calloc(1, sizeof(vo_overlay_t)); pthread_mutex_init (&this->osd_mutex, NULL); |