Author: cazfi
Date: Wed Jan 21 21:11:16 2015
New Revision: 27761

URL: http://svn.gna.org/viewcvs/freeciv?rev=27761&view=rev
Log:
sdl-clients' create_string16() returns NULL instead of illegal pointer when 
font loading fails.

See bug #23195

Modified:
    branches/S2_5/client/gui-sdl/gui_string.c

Modified: branches/S2_5/client/gui-sdl/gui_string.c
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_5/client/gui-sdl/gui_string.c?rev=27761&r1=27760&r2=27761&view=diff
==============================================================================
--- branches/S2_5/client/gui-sdl/gui_string.c   (original)
+++ branches/S2_5/client/gui-sdl/gui_string.c   Wed Jan 21 21:11:16 2015
@@ -157,8 +157,8 @@
   Font will be loaded or aliased with existing font of that size.
   pInTextString must be allocated in memory (MALLOC/fc_calloc)
 **************************************************************************/
-SDL_String16 * create_string16(Uint16 *pInTextString,
-                                       size_t n_alloc, Uint16 ptsize)
+SDL_String16 *create_string16(Uint16 *pInTextString,
+                              size_t n_alloc, Uint16 ptsize)
 {
   SDL_String16 *str = fc_calloc(1, sizeof(SDL_String16));
 
@@ -171,7 +171,8 @@
   if ((str->font = load_font(str->ptsize)) == NULL) {
     log_error("create_string16: load_font failed");
     FC_FREE(str);
-    return str;
+
+    return NULL;
   }
 
   str->style = TTF_STYLE_NORMAL;


_______________________________________________
Freeciv-commits mailing list
Freeciv-commits@gna.org
https://mail.gna.org/listinfo/freeciv-commits

Reply via email to