[MPlayer-cvslog] r36179 - trunk/gui/dialog/url.c

ib subversion at mplayerhq.hu
Mon Apr 29 13:36:53 CEST 2013


Author: ib
Date: Mon Apr 29 13:36:53 2013
New Revision: 36179

Log:
Check return value to avoid segmentation fault.

Modified:
   trunk/gui/dialog/url.c

Modified: trunk/gui/dialog/url.c
==============================================================================
--- trunk/gui/dialog/url.c	Mon Apr 29 13:21:23 2013	(r36178)
+++ trunk/gui/dialog/url.c	Mon Apr 29 13:36:53 2013	(r36179)
@@ -53,11 +53,15 @@ static void button_clicked(GtkButton *bu
                 char *tmp;
 
                 tmp = malloc(strlen(str) + 8);
-                sprintf(tmp, "http://%s", str);
+
+                if (tmp)
+                    sprintf(tmp, "http://%s", str);
+
                 free(str);
                 str = tmp;
             }
 
+            if (str) {
             item      = calloc(1, sizeof(urlItem));
             item->url = gstrdup(str);
             listMgr(URLLIST_ITEM_ADD, item);
@@ -67,6 +71,7 @@ static void button_clicked(GtkButton *bu
             add_to_gui_playlist(str, PLAYLIST_ITEM_APPEND);
             guiInfo.NewPlay = GUI_FILE_NEW;
             uiEvent(evPlay, 0);
+            }
         }
     }
 


More information about the MPlayer-cvslog mailing list