diff options
badwolf.c: g_malloc → malloc+perror+exit
1 files changed, 7 insertions, 2 deletions
| -rw-r--r-- | badwolf.c | 9 |
@@ -11,7 +11,7 @@ #include <glib/gi18n.h> /* _() and other internationalization/localization helpers */ #include <libsoup/soup.h> /* soup* */ #include <locale.h> /* LC_* */ -#include <stdio.h> /* fprintf() */ +#include <stdio.h> /* perror(), fprintf() */ #include <stdlib.h> /* malloc() */ const gchar *homepage = "https://hacktivis.me/projects/badwolf"; @@ -745,7 +745,12 @@ int main(int argc, char *argv[]) { // getting an abort if this one fails to alloc - struct Window *window = g_malloc(sizeof(struct Window)); + struct Window *window = malloc(sizeof(struct Window)); + if(window == NULL) + { + perror("malloc"); + return 1; + } setlocale(LC_ALL, ""); bindtextdomain(PACKAGE, DATADIR "/locale"); |