commit: ccc42ba4f8e1e87f949b055c77d875be450aff48
parent: e97228fc74b15026f2c8db56c069ffed11898d4d
Author: Haelwenn (lanodan) Monnier <contact@hacktivis.me>
Date: Wed, 8 Jan 2020 10:08:05 +0100
badwolf.c: g_malloc → malloc+perror+exit
Diffstat:
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/badwolf.c b/badwolf.c
@@ -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");