2 Coverity defects for mutex lock and resource leak
Bryce Harrington <[email protected]>
| Newsgroups | gmane.comp.lib.cairo |
|---|---|
| Message-ID | <[email protected]> |
----- Forwarded message from [email protected] ----- Date: Thu, 11 Jan 2018 13:53:28 +0000 (UTC) From: [email protected] To: [email protected] Subject: New Defects reported by Coverity Scan for cairo Hi, Please find the latest report on new defect(s) introduced to cairo found with Coverity Scan. 2 new defect(s) introduced to cairo found with Coverity Scan. New defect(s) Reported-by: Coverity Scan Showing 2 of 2 defect(s) ** CID 1160664: (ORDER_REVERSAL) /src/cairo-scaled-font.c: 408 in _cairo_scaled_font_map_destroy() /src/cairo-scaled-font.c: 419 in _cairo_scaled_font_map_destroy() ________________________________________________________________________________________________________ *** CID 1160664: (ORDER_REVERSAL) /src/cairo-scaled-font.c: 408 in _cairo_scaled_font_map_destroy() 402 void 403 _cairo_scaled_font_map_destroy (void) 404 { 405 cairo_scaled_font_map_t *font_map; 406 cairo_scaled_font_t *scaled_font; 407 >>> CID 1160664: (ORDER_REVERSAL) >>> Calling "pthread_mutex_lock" acquires lock "_cairo_scaled_font_map_mutex". 408 CAIRO_MUTEX_LOCK (_cairo_scaled_font_map_mutex); 409 410 font_map = cairo_scaled_font_map; 411 if (unlikely (font_map == NULL)) { 412 goto CLEANUP_MUTEX_LOCK; 413 } /src/cairo-scaled-font.c: 419 in _cairo_scaled_font_map_destroy() 413 } 414 415 scaled_font = font_map->mru_scaled_font; 416 if (scaled_font != NULL) { 417 CAIRO_MUTEX_UNLOCK (_cairo_scaled_font_map_mutex); 418 cairo_scaled_font_destroy (scaled_font); >>> CID 1160664: (ORDER_REVERSAL) >>> Calling "pthread_mutex_lock" acquires lock "_cairo_scaled_font_map_mutex". 419 CAIRO_MUTEX_LOCK (_cairo_scaled_font_map_mutex); 420 } 421 422 /* remove scaled_fonts starting from the end so that font_map->holdovers 423 * is always in a consistent state when we release the mutex. */ 424 while (font_map->num_holdovers) { ** CID 1384409: (RESOURCE_LEAK) /test/font-variations.c: 79 in test_variation() /test/font-variations.c: 90 in test_variation() ________________________________________________________________________________________________________ *** CID 1384409: (RESOURCE_LEAK) /test/font-variations.c: 79 in test_variation() 73 } 74 75 cairo_matrix_init_identity (&matrix); 76 options = cairo_font_options_create (); 77 if (cairo_font_options_status (options) != CAIRO_STATUS_SUCCESS) { 78 cairo_test_log (ctx, "Failed to create font options"); >>> CID 1384409: (RESOURCE_LEAK) >>> Variable "options" going out of scope leaks the storage it points to. 79 return CAIRO_TEST_FAILURE; 80 } 81 82 cairo_font_options_set_variations (options, input); 83 if (cairo_font_options_status (options) != CAIRO_STATUS_SUCCESS) { 84 cairo_test_log (ctx, "Failed to set variations"); /test/font-variations.c: 90 in test_variation() 84 cairo_test_log (ctx, "Failed to set variations"); 85 return CAIRO_TEST_FAILURE; 86 } 87 88 if (strcmp (cairo_font_options_get_variations (options), input) != 0) { 89 cairo_test_log (ctx, "Failed to verify variations"); >>> CID 1384409: (RESOURCE_LEAK) >>> Variable "options" going out of scope leaks the storage it points to. 90 return CAIRO_TEST_FAILURE; 91 } 92 93 scaled_font = cairo_scaled_font_create (font_face, &matrix, &matrix, options); 94 status = cairo_scaled_font_status (scaled_font); 95 ________________________________________________________________________________________________________ To view the defects in Coverity Scan visit, https://u2389337.ct.sendgrid.net/wf/click?upn=08onrYu34A-2BWcWUl-2F-2BfV0V05UPxvVjWch-2Bd2MGckcRYBVq1m2VVFFtru2Iik9cRpHpWQ8KWLzSt4vL-2FjpvJ6nA-3D-3D_aYL1tHQ2WsGJ1WWHn5YMNI6HD3pxvHAZurBiLJcMqUHcIzs3gez-2Bciq472U1gQPoQ3S-2BHoH-2BvFxZfWUJmjO4LkVCO2617truUzcN1QBNcA3U459-2BJkMljuLF006SljWVcGK1f-2BZ6A2y-2FkUNcTeZPnkZAeT7l9gKEewkIOEGUUGEGI7icUQ7WjaYen85DIXbDEnuRhtWTWwabiOnJalH4no5FBOD7-2FoJc-2FUFLabB3LT0-3D To manage Coverity Scan email notifications for "[email protected]", click https://u2389337.ct.sendgrid.net/wf/click?upn=08onrYu34A-2BWcWUl-2F-2BfV0V05UPxvVjWch-2Bd2MGckcRbVDbis712qZDP-2FA8y06Nq4M5gXD4-2B1M2b-2FQ5LllV8Y7wsFU6DRZ5s-2FMBltdY5uhuEAlCPpTdF-2BmF6-2BGC5NYh6AFrlncBQ2GLEjbpDuCP4Eevb4up3YU5HVKSuZZHfK3cE-3D_aYL1tHQ2WsGJ1WWHn5YMNI6HD3pxvHAZurBiLJcMqUHcIzs3gez-2Bciq472U1gQPobi53xRyPzXXTyEALeJZz5vI5ir-2Bx6-2FiD-2FthqGizDGqOrDnG48fndYcd87Qeb4SrhUKS7kDybjtTr-2Fb-2BAHg1qL0kjQ2vr4CcPYR8zlw5avAxk-2BSdX5AHkiR15xAB1rsehx-2FMCTV3QSgEVDuIaH1-2FlhG-2Bfdzd-2FGEdGSfZAaSQT43s-3D ----- End forwarded message ----- -- cairo mailing list [email protected] https://lists.cairographics.org/mailman/listinfo/cairo