From: splidge Date: Fri, 6 Jul 2007 10:32:51 +0000 (+0100) Subject: Tidied up some gratuitous malloc-failure code X-Git-Url: https://jfr.im/git/irc/quakenet/newserv.git/commitdiff_plain/b8dc4a0e89975f30b3ff35d677c55676165c8d7b Tidied up some gratuitous malloc-failure code --- diff --git a/proxyscan/proxyscanqueue.c b/proxyscan/proxyscanqueue.c index 2ea410af..be5f1b25 100644 --- a/proxyscan/proxyscanqueue.c +++ b/proxyscan/proxyscanqueue.c @@ -5,6 +5,7 @@ #include "proxyscan.h" #include "../irc/irc.h" +#include "../core/error.h" pendingscan *ps_normalqueue=NULL; pendingscan *ps_prioqueue=NULL; @@ -53,16 +54,11 @@ void queuescan(unsigned int IP, short scantype, unsigned short port, char class, } /* We have to queue it */ - psp = (struct pendingscan *) malloc(sizeof(pendingscan)); - if (!psp) - { - /* shutdown due to no memory */ - irc_send("%s SQ %s 0 :Out of memory - exiting.",mynumeric->content,myserver->content); - irc_disconnected(); - exit(0); - } else { - countpendingscan++; - } + if (!(psp=(struct pendingscan *)malloc(sizeof(pendingscan)))) + Error("proxyscan",ERR_STOP,"Unable to allocate memory"); + + countpendingscan++; + psp->IP=IP; psp->type=scantype; psp->port=port;