From edca92c10572b6bb7dd60db156f545d98373f803 Mon Sep 17 00:00:00 2001 From: Alan Coopersmith Date: Fri, 30 Sep 2011 20:19:44 -0700 Subject: Stop wrapping malloc & free Signed-off-by: Alan Coopersmith Reviewed-by: Jeremy Huddleston --- extensions.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'extensions.c') diff --git a/extensions.c b/extensions.c index b120b3e..cf5421f 100644 --- a/extensions.c +++ b/extensions.c @@ -87,7 +87,9 @@ DefineExtNameValue(int type, unsigned char value, const char *extname) panic("Impossible argument to DefineExtNameValue"); } namelen += strlen(typename); - exttypename = Malloc(namelen); + exttypename = malloc(namelen); + if (exttypename == NULL) + panic("Can't allocate memory for ExtNameValue"); snprintf(exttypename, namelen, "%s%s", extname, typename); DefineEValue(&TD[type], (unsigned long) value, exttypename); } @@ -96,22 +98,26 @@ void ProcessQueryExtensionRequest(long seq, const unsigned char *buf) { int namelen = IShort(&buf[4]); - char *extname = Malloc(namelen + 1); + char *extname = malloc(namelen + 1); struct extension_info *qe; + if (extname == NULL) + panic("Can't allocate memory for ExtensionRequest name"); memcpy(extname, &buf[8], namelen); extname[namelen] = '\0'; for (qe = query_list; qe != NULL; qe = qe->next) { if (strcmp(extname, qe->name) == 0) { /* already in list, no need to add */ - Free(extname); + free(extname); return; } } /* add to list */ - qe = Malloc(sizeof(struct extension_info)); + qe = malloc(sizeof(struct extension_info)); + if (qe == NULL) + panic("Can't allocate memory for extension_info"); qe->name = extname; qe->request = 0; qe->event = 0; -- cgit v1.2.1