struct fillobj * pamd_fill_create(void) { fillobj * fillObjP; struct fillState * stateP; MALLOCVAR(fillObjP); if (fillObjP == NULL) pm_error("out of memory allocating a fillhandle"); MALLOCVAR(stateP); if (stateP == NULL) pm_error("out of memory allocating a fillhandle"); stateP->n = 0; stateP->size = SOME; MALLOCARRAY(stateP->coords, stateP->size); if (stateP->coords == NULL) pm_error("out of memory allocating a fillhandle"); stateP->curedge = 0; fillObjP->stateP = stateP; /* Turn off line clipping. */ /* UGGH! We must eliminate this global variable */ oldclip = pamd_setlineclip(0); return fillObjP; }
struct lock * xmlrpc_lock_create_windows(void) { struct lock * lockP; MALLOCVAR(lockP); if (lockP) { CRITICAL_SECTION * criticalSectionP; MALLOCVAR(criticalSectionP); if (criticalSectionP) { InitializeCriticalSection(criticalSectionP); lockP->implementationP = criticalSectionP; lockP->acquire = &acquire; lockP->release = &release; lockP->destroy = &destroy; } else { free(lockP); lockP = NULL; } } return lockP; }
static void createPath(const char * const pathText, style const style, path ** const pathPP) { /*---------------------------------------------------------------------------- Create a path as described by a <path> element whose "style" attribute indicates style 'style' and whose "d" attribute indicates path data 'pathText'. -----------------------------------------------------------------------------*/ bool error; path * pathP; MALLOCVAR(pathP); if (pathP == NULL) error = TRUE; else { pathP->style = style; pathP->pathText = strdup(pathText); if (pathP->pathText == NULL) error = TRUE; else { pathP->pathTextLength = strlen(pathP->pathText); error = FALSE; } if (error) free(pathP); } if (error ) *pathPP = NULL; else *pathPP = pathP; }
xmlrpc_server_info * xmlrpc_server_info_new(xmlrpc_env * const envP, const char * const serverUrl) { xmlrpc_server_info * serverInfoP; XMLRPC_ASSERT_ENV_OK(envP); XMLRPC_ASSERT_PTR_OK(serverUrl); MALLOCVAR(serverInfoP); if (serverInfoP == NULL) xmlrpc_faultf(envP, "Couldn't allocate memory for xmlrpc_server_info"); else { serverInfoP->serverUrl = strdup(serverUrl); if (serverInfoP->serverUrl == NULL) xmlrpc_faultf(envP, "Couldn't allocate memory for server URL"); else { serverInfoP->allowedAuth.basic = false; serverInfoP->allowedAuth.digest = false; serverInfoP->allowedAuth.gssnegotiate = false; serverInfoP->allowedAuth.ntlm = false; serverInfoP->userNamePw = NULL; serverInfoP->basicAuthHdrValue = NULL; if (envP->fault_occurred) xmlrpc_strfree(serverInfoP->serverUrl); } if (envP->fault_occurred) free(serverInfoP); } return serverInfoP; }
void ppmd_read_font(FILE * const ifP, const struct ppmd_font ** const fontPP) { unsigned int relativeCodePoint; struct ppmd_glyph * glyphTable; struct ppmd_font * fontP; MALLOCVAR(fontP); if (fontP == NULL) pm_error("Insufficient memory for font header"); readFontHeader(ifP, &fontP->header); MALLOCARRAY(glyphTable, fontP->header.characterCount); if (glyphTable == NULL) pm_error("Insufficient memory to store %u characters", fontP->header.characterCount); for (relativeCodePoint = 0; relativeCodePoint < fontP->header.characterCount; ++relativeCodePoint) { readCharacter(ifP, &glyphTable[relativeCodePoint]); } fontP->glyphTable = glyphTable; *fontPP = fontP; }
void xmlrpc_methodCreate(xmlrpc_env * const envP, xmlrpc_method1 methodFnType1, xmlrpc_method2 methodFnType2, void * const userData, const char * const signatureString, const char * const helpText, xmlrpc_methodInfo ** const methodPP) { xmlrpc_methodInfo * methodP; XMLRPC_ASSERT_ENV_OK(envP); MALLOCVAR(methodP); if (methodP == NULL) xmlrpc_faultf(envP, "Unable to allocate storage for a method " "descriptor"); else { methodP->methodFnType1 = methodFnType1; methodP->methodFnType2 = methodFnType2; methodP->userData = userData; methodP->helpText = strdup(helpText); makeSignatureList(envP, signatureString, &methodP->signatureListP); if (envP->fault_occurred) free(methodP); *methodPP = methodP; } }
static void createFileImage(TFile ** const filePP, const char * const name, uint32_t const attrib, bool const createFile, bool * const succeededP) { TFile * fileP; MALLOCVAR(fileP); if (fileP == NULL) *succeededP = FALSE; else { int rc; if (createFile) rc = open(name, attrib | O_CREAT, S_IWRITE | S_IREAD); else rc = open(name, attrib); if (rc < 0) *succeededP = FALSE; else { fileP->fd = rc; *succeededP = TRUE; } if (!*succeededP) free(fileP); } *filePP = fileP; }
static IC_Entry readICEntry (void) { IC_Entry entry; MALLOCVAR(entry); if (entry == NULL) pm_error("Unable to allcoate memory for IC entry"); entry->width = readU1(); entry->height = readU1(); entry->color_count = readU1(); entry->reserved = readU1(); entry->planes = readU2(); entry->bitcount = readU2(); entry->size_in_bytes = readU4(); entry->file_offset = readU4(); entry->colors = NULL; entry->ih = NULL; entry->xorBitmap = NULL; entry->andBitmap = NULL; return entry; }
static void createServer(struct _TServer ** const srvPP, bool const noAccept, TChanSwitch * const chanSwitchP, bool const userChanSwitch, unsigned short const portNumber, const char ** const errorP) { struct _TServer * srvP; MALLOCVAR(srvP); if (srvP == NULL) { xmlrpc_asprintf(errorP, "Unable to allocate space for server descriptor"); } else { setupTrace(srvP); srvP->terminationRequested = false; initChanSwitchStuff(srvP, noAccept, chanSwitchP, userChanSwitch, portNumber, errorP); if (!*errorP) { srvP->builtinHandlerP = HandlerCreate(); if (!srvP->builtinHandlerP) xmlrpc_asprintf(errorP, "Unable to allocate space for " "builtin handler descriptor"); else { srvP->defaultHandler = HandlerDefaultBuiltin; srvP->defaultHandlerContext = srvP->builtinHandlerP; srvP->name = strdup("unnamed"); srvP->logfilename = NULL; srvP->keepalivetimeout = 15; srvP->keepalivemaxconn = 30; srvP->timeout = 15; srvP->advertise = TRUE; srvP->useSigchld = FALSE; srvP->uriHandlerStackSize = 0; srvP->maxConn = 15; srvP->maxConnBacklog = 15; initUnixStuff(srvP); ListInitAutoFree(&srvP->handlers); srvP->logfileisopen = FALSE; *errorP = NULL; if (*errorP) HandlerDestroy(srvP->builtinHandlerP); } } if (*errorP) free(srvP); } *srvPP = srvP; }
static void disposeOfCommandTokens(struct tokenSet * const tokenSetP, struct script * const scriptP) { /* We've got a whole command in 'tokenSet'. Parse it into *scriptP and reset tokenSet to empty. */ struct commandListElt * commandListEltP; MALLOCVAR(commandListEltP); if (commandListEltP == NULL) pm_error("Out of memory allocating command list element frame"); parseDrawCommand(*tokenSetP, &commandListEltP->commandP); { unsigned int i; for (i = 0; i < tokenSetP->count; ++i) pm_strfree(tokenSetP->token[i]); tokenSetP->count = 0; } /* Put the list element for this command at the tail of the list */ commandListEltP->nextP = NULL; if (scriptP->commandListTailP) scriptP->commandListTailP->nextP = commandListEltP; else scriptP->commandListHeadP = commandListEltP; scriptP->commandListTailP = commandListEltP; }
void SocketUnixCreate(TSocket ** const socketPP) { struct socketUnix * socketUnixP; MALLOCVAR(socketUnixP); if (socketUnixP) { int rc; rc = socket(AF_INET, SOCK_STREAM, 0); if (rc < 0) *socketPP = NULL; else { socketUnixP->fd = rc; socketUnixP->userSuppliedFd = FALSE; { int32_t n = 1; int rc; rc = setsockopt(socketUnixP->fd, SOL_SOCKET, SO_REUSEADDR, (char*)&n, sizeof(n)); if (rc < 0) *socketPP = NULL; else SocketCreate(&vtbl, socketUnixP, socketPP); } if (!*socketPP) close(socketUnixP->fd); } if (!*socketPP) free(socketUnixP); } else *socketPP = NULL; }
static void makeChannelFromSsl(SSL * const sslP, TChannel ** const channelPP, const char ** const errorP) { struct channelOpenssl * channelOpensslP; MALLOCVAR(channelOpensslP); if (channelOpensslP == NULL) xmlrpc_asprintf(errorP, "Unable to allocate memory for OpenSSL " "socket descriptor"); else { TChannel * channelP; channelOpensslP->sslP = sslP; channelOpensslP->userSuppliedSsl = TRUE; /* This should be ok as far as I can tell */ ChannelCreate(&channelVtbl, channelOpensslP, &channelP); if (channelP == NULL) xmlrpc_asprintf(errorP, "Unable to allocate memory for " "channel descriptor."); else { *channelPP = channelP; *errorP = NULL; } if (*errorP) free(channelOpensslP); } }
xmlrpc_value * xmlrpc_datetime_new(xmlrpc_env *const envP, xmlrpc_datetime const dt) { xmlrpc_value *valP; const char **readBufferP; MALLOCVAR(readBufferP); if (!readBufferP) xmlrpc_faultf(envP, "Couldn't get memory for the cache part of the " "XML-RPC datetime value object"); else { *readBufferP = NULL; xmlrpc_createXmlrpcValue(envP, &valP); if (!envP->fault_occurred) { valP->_type = XMLRPC_TYPE_DATETIME; valP->_value.dt = dt; valP->_cache = readBufferP; } if (envP->fault_occurred) free(readBufferP); } return valP; }
curlMulti * curlMulti_create(void) { curlMulti * retval; curlMulti * curlMultiP; MALLOCVAR(curlMultiP); if (curlMultiP == NULL) retval = NULL; else { curlMultiP->lockP = xmlrpc_lock_create(); if (curlMultiP->lockP == NULL) retval = NULL; else { curlMultiP->curlMultiP = curl_multi_init(); if (curlMultiP->curlMultiP == NULL) retval = NULL; else retval = curlMultiP; if (retval == NULL) curlMultiP->lockP->destroy(curlMultiP->lockP); } if (retval == NULL) free(curlMultiP); } return retval; }
struct sourceManager * dsCreateSource(const char * const fileName) { struct sourceManager * srcP; MALLOCVAR(srcP); if (srcP == NULL) pm_error("Unable to get memory for the Jpeg library source manager."); srcP->ifP = pm_openr(fileName); srcP->jpegSourceMgr.init_source = dsInitSource; srcP->jpegSourceMgr.fill_input_buffer = dsFillInputBuffer; srcP->jpegSourceMgr.skip_input_data = dsSkipInputData; srcP->jpegSourceMgr.resync_to_restart = jpeg_resync_to_restart; srcP->jpegSourceMgr.term_source = dsTermSource; srcP->prematureEof = FALSE; srcP->currentBuffer = srcP->buffer1; srcP->nextBuffer = srcP->buffer2; srcP->jpegSourceMgr.bytes_in_buffer = fread(srcP->currentBuffer, 1, BUFFER_SIZE, srcP->ifP); srcP->jpegSourceMgr.next_input_byte = srcP->currentBuffer; srcP->bytesInNextBuffer = fread(srcP->nextBuffer, 1, BUFFER_SIZE, srcP->ifP); return srcP; }
static IC_InfoHeader readInfoHeader (IC_Entry entry) { IC_InfoHeader ih; MALLOCVAR(ih); if (ih == NULL) pm_error("Unable to allocate memory for info header"); ih->size = readU4(); ih->width = readU4(); ih->height = readU4(); ih->planes = readU2(); ih->bitcount = readU2(); ih->compression = readU4(); ih->imagesize = readU4(); ih->x_pixels_per_m = readU4(); ih->y_pixels_per_m = readU4(); ih->colors_used = readU4(); ih->colors_important = readU4(); if (!entry->bitcount) entry->bitcount = ih->bitcount; if (entry->color_count == 0 && entry->bitcount <= 8) entry->color_count = 256; if (ih->compression) { pm_error("Can't handle compressed icons"); } return ih; }
static ppm_fs_info * allocateFi(int const cols) { ppm_fs_info * fi; MALLOCVAR(fi); if (fi != NULL) { MALLOCARRAY(fi->thisrederr , cols + 2); MALLOCARRAY(fi->thisgreenerr, cols + 2); MALLOCARRAY(fi->thisblueerr , cols + 2); MALLOCARRAY(fi->nextrederr , cols + 2); MALLOCARRAY(fi->nextgreenerr, cols + 2); MALLOCARRAY(fi->nextblueerr , cols + 2); if (fi->thisrederr == NULL || fi->thisgreenerr == NULL || fi->thisblueerr == NULL || fi->nextrederr == NULL || fi->nextgreenerr == NULL || fi->nextblueerr == NULL) pm_error("out of memory allocating " "Floyd-Steinberg control structure"); } else pm_error("out of memory allocating Floyd-Steinberg control structure"); return(fi); }
void ThreadCreate(TThread ** const threadPP, void * const userHandle, TThreadProc * const func, TThreadDoneFn * const threadDone, bool const useSigchld, size_t const stackSize, const char ** const errorP) { TThread * threadP; MALLOCVAR(threadP); if (threadP == NULL) xmlrpc_asprintf(errorP, "Can't allocate memory for thread descriptor."); else { sigset_t oldBlockedSet; pid_t rc; threadP->nextInPoolP = NULL; threadP->threadDone = threadDone; threadP->userHandle = userHandle; threadP->useSigchld = useSigchld; threadP->pid = 0; /* We have to be sure we don't get the SIGCHLD for this child's death until the child is properly registered in the thread pool so that the handler will know who he is. */ blockSignalClass(SIGCHLD, &oldBlockedSet); rc = fork(); if (rc < 0) xmlrpc_asprintf(errorP, "fork() failed, errno=%d (%s)", errno, strerror(errno)); else if (rc == 0) { /* This is the child */ (*func)(userHandle); /* Note that thread cleanup (threadDone) is done by the _parent_, upon seeing our exit. */ exit(0); } else { /* This is the parent */ threadP->pid = rc; addToPool(threadP); sigprocmask(SIG_SETMASK, &oldBlockedSet, NULL); /* restore */ *errorP = NULL; *threadPP = threadP; } if (*errorP) { removeFromPool(threadP); free(threadP); } } }
static void makeChannelFromWinsock(SOCKET const winsock, TChannel ** const channelPP, const char ** const errorP) { struct socketWin * socketWinP; MALLOCVAR(socketWinP); if (socketWinP == NULL) xmlrpc_asprintf(errorP, "Unable to allocate memory for Windows " "socket descriptor"); else { TChannel * channelP; socketWinP->winsock = winsock; socketWinP->userSuppliedWinsock = TRUE; socketWinP->interruptEvent = CreateEvent(NULL, FALSE, FALSE, NULL); ChannelCreate(&channelVtbl, socketWinP, &channelP); if (channelP == NULL) xmlrpc_asprintf(errorP, "Unable to allocate memory for " "channel descriptor."); else { *channelPP = channelP; *errorP = NULL; } if (*errorP) { CloseHandle(socketWinP->interruptEvent); free(socketWinP); } } }
void ChanSwitchWinCreateWinsock(SOCKET const winsock, TChanSwitch ** const chanSwitchPP, const char ** const errorP) { struct socketWin * socketWinP; if (connected(winsock)) xmlrpc_asprintf(errorP, "Socket is in connected state."); else { MALLOCVAR(socketWinP); if (socketWinP == NULL) xmlrpc_asprintf(errorP, "unable to allocate memory for Windows " "socket descriptor."); else { TChanSwitch * chanSwitchP; socketWinP->winsock = winsock; socketWinP->userSuppliedWinsock = TRUE; ChanSwitchCreate(&chanSwitchVtbl, socketWinP, &chanSwitchP); if (chanSwitchP == NULL) xmlrpc_asprintf(errorP, "Unable to allocate memory for " "channel switch descriptor"); else { *chanSwitchPP = chanSwitchP; *errorP = NULL; } if (*errorP) free(socketWinP); } } }
static xml_element * xmlElementNew(xmlrpc_env * const envP, const char * const name) { /*---------------------------------------------------------------------------- Create a new xml_element. This routine isn't exported, because the arguments are implementation-dependent. -----------------------------------------------------------------------------*/ xml_element * retval; bool nameIsValid; bool cdataIsValid; bool childrenAreValid; XMLRPC_ASSERT_ENV_OK(envP); assert(name != NULL); /* Set up our error-handling preconditions. */ retval = NULL; nameIsValid = cdataIsValid = childrenAreValid = false; MALLOCVAR(retval); XMLRPC_FAIL_IF_NULL(retval, envP, XMLRPC_INTERNAL_ERROR, "Couldn't allocate memory for XML element"); retval->parentP = NULL; /* Copy over the element name. */ retval->name = strdup(name); XMLRPC_FAIL_IF_NULL(retval->name, envP, XMLRPC_INTERNAL_ERROR, "Couldn't allocate memory for XML element"); nameIsValid = true; /* Initialize a block to hold our CDATA. */ XMLRPC_TYPED_MEM_BLOCK_INIT(char, envP, &retval->cdata, 0); XMLRPC_FAIL_IF_FAULT(envP); cdataIsValid = true; /* Initialize a block to hold our child elements. */ XMLRPC_TYPED_MEM_BLOCK_INIT(xml_element *, envP, &retval->children, 0); XMLRPC_FAIL_IF_FAULT(envP); childrenAreValid = true; cleanup: if (envP->fault_occurred) { if (retval) { if (nameIsValid) xmlrpc_strfree(retval->name); if (cdataIsValid) xmlrpc_mem_block_clean(&retval->cdata); if (childrenAreValid) xmlrpc_mem_block_clean(&retval->children); free(retval); } retval = NULL; } return retval; }
static void parseOneSignature(xmlrpc_env * const envP, const char * const startP, struct xmlrpc_signature ** const signaturePP, const char ** const nextPP) { /*---------------------------------------------------------------------------- Parse one signature from the signature string that starts at 'startP'. Return that signature as a signature object *signaturePP. Return as *nextP the location in the signature string of the next signature (i.e. right after the next comma). If there is no next signature (the string ends before any comma), make it point to the terminating NUL. -----------------------------------------------------------------------------*/ struct xmlrpc_signature * signatureP; MALLOCVAR(signatureP); if (signatureP == NULL) xmlrpc_faultf(envP, "Couldn't get memory for signature"); else { const char * cursorP; signatureP->argListSpace = 0; /* Start with no argument space */ signatureP->argList = NULL; /* Nothing allocated yet */ signatureP->argCount = 0; /* Start with no arguments */ cursorP = startP; /* start at the beginning */ if (*cursorP == ',' || *cursorP == '\0') xmlrpc_faultf(envP, "empty signature (a signature " "must have at least return value type)"); else { translateTypeSpecifierToName(envP, *cursorP, &signatureP->retType); ++cursorP; if (*cursorP != ':') xmlrpc_faultf(envP, "No colon (':') after " "the result type specifier"); else { ++cursorP; parseArgumentTypeSpecifiers(envP, cursorP, signatureP, nextPP); } } if (envP->fault_occurred) free(signatureP); else *signaturePP = signatureP; } }
static void createChannelForAccept(int const acceptedFd, struct sockaddr const peerAddr, TChannel ** const channelPP, void ** const channelInfoPP, const char ** const errorP) { /*---------------------------------------------------------------------------- Make a channel object (TChannel) out of a socket just created by accept() on a listening socket -- i.e. a socket for a client connection. 'acceptedFd' is the file descriptor of the socket. 'peerAddr' is the address of the client, from accept(). -----------------------------------------------------------------------------*/ struct abyss_unix_chaninfo * channelInfoP; makeChannelInfo(&channelInfoP, peerAddr, sizeof(peerAddr), errorP); if (!*errorP) { struct socketUnix * acceptedSocketP; MALLOCVAR(acceptedSocketP); if (!acceptedSocketP) xmlrpc_asprintf(errorP, "Unable to allocate memory"); else { acceptedSocketP->fd = acceptedFd; acceptedSocketP->userSuppliedFd = FALSE; initInterruptPipe(&acceptedSocketP->interruptPipe, errorP); if (!*errorP) { TChannel * channelP; ChannelCreate(&channelVtbl, acceptedSocketP, &channelP); if (!channelP) xmlrpc_asprintf(errorP, "Failed to create TChannel object."); else { *errorP = NULL; *channelPP = channelP; *channelInfoPP = channelInfoP; } if (*errorP) termInterruptPipe(acceptedSocketP->interruptPipe); } if (*errorP) free(acceptedSocketP); } if (*errorP) free(channelInfoP); } }
static void socketCreate(TSocket ** const socketPP) { TSocket * socketP; MALLOCVAR(socketP); if (socketP) { socketP->signature = socketSignature; *socketPP = socketP; } else *socketPP = NULL; }
BIHandler * HandlerCreate(void) { struct BIHandler *handlerP; MALLOCVAR(handlerP); if (handlerP) { handlerP->filesPath = strdup(DEFAULT_DOCS); ListInitAutoFree(&handlerP->defaultFileNames); handlerP->mimeTypeP = NULL; } return handlerP; }
MIMEType * MIMETypeCreate(void) { MIMEType * MIMETypeP; MALLOCVAR(MIMETypeP); if (MIMETypeP) { ListInit(&MIMETypeP->typeList); ListInit(&MIMETypeP->extList); PoolCreate(&MIMETypeP->pool, 1024); } return MIMETypeP; }
void ChanSwitchWinCreate(uint16_t const portNumber, TChanSwitch ** const chanSwitchPP, const char ** const errorP) { /*---------------------------------------------------------------------------- Create a Winsock-based channel switch. Set the socket's local address so that a subsequent "listen" will listen on all IP addresses, port number 'portNumber'. -----------------------------------------------------------------------------*/ struct socketWin * socketWinP; MALLOCVAR(socketWinP); if (!socketWinP) xmlrpc_asprintf(errorP, "Unable to allocate memory for Windows socket " "descriptor structure."); else { SOCKET winsock; winsock = socket(AF_INET, SOCK_STREAM, 0); if (winsock == 0 || winsock == INVALID_SOCKET) { int const lastError = WSAGetLastError(); xmlrpc_asprintf(errorP, "socket() failed with WSAERROR %d (%s)", lastError, getWSAError(lastError)); } else { socketWinP->winsock = winsock; socketWinP->userSuppliedWinsock = FALSE; socketWinP->interruptEvent = CreateEvent(NULL, FALSE, FALSE, NULL); setSocketOptions(socketWinP->winsock, errorP); if (!*errorP) { bindSocketToPort(socketWinP->winsock, NULL, portNumber, errorP); if (!*errorP) ChanSwitchCreate(&chanSwitchVtbl, socketWinP, chanSwitchPP); } if (*errorP) { CloseHandle(socketWinP->interruptEvent); closesocket(winsock); } } if (*errorP) free(socketWinP); } }
/* * I don't know why this isn't the same as the spec, it just <b>isn't</b> * The colors honestly seem to be stored BGR. Bizarre. * * I've checked this in the BMP code for bmptoppm and the gimp. Guess the * spec I have is just plain wrong. */ static IC_Color readICColor (void) { IC_Color col; MALLOCVAR(col); if (col == NULL) pm_error("Unable to allocate memory for color"); col->blue = readU1(); col->green = readU1(); col->red = readU1(); col->reserved = readU1(); return col; }
void SocketCreate(const struct TSocketVtbl * const vtblP, void * const implP, TSocket ** const socketPP) { TSocket * socketP; MALLOCVAR(socketP); if (socketP) { socketP->implP = implP; socketP->vtbl = *vtblP; socketP->signature = socketSignature; *socketPP = socketP; } }
static void createServer(struct _TServer ** const srvPP, abyss_bool const noAccept, TSocket * const userSocketP, uint16_t const portNumber, const char ** const errorP) { struct _TServer * srvP; MALLOCVAR(srvP); if (srvP == NULL) { xmlrpc_asprintf(errorP, "Unable to allocate space for server descriptor"); } else { srvP->terminationRequested = false; initSocketStuff(srvP, noAccept, userSocketP, portNumber, errorP); if (!*errorP) { srvP->defaulthandler = ServerDefaultHandlerFunc; srvP->name = strdup("unnamed"); srvP->filespath = strdup(DEFAULT_DOCS); srvP->logfilename = NULL; srvP->keepalivetimeout = 15; srvP->keepalivemaxconn = 30; srvP->timeout = 15; srvP->advertise = TRUE; srvP->mimeTypeP = NULL; srvP->useSigchld = FALSE; initUnixStuff(srvP); ListInitAutoFree(&srvP->handlers); ListInitAutoFree(&srvP->defaultfilenames); srvP->logfileisopen = FALSE; *errorP = NULL; } if (*errorP) free(srvP); } *srvPP = srvP; }