search for: pc_ctx

Displaying 2 results from an estimated 2 matches for "pc_ctx".

Did you mean: cp_ctx
2008 Jan 26
1
Memory leak in upsmon
Hello, I was running upsmon some time without UPS connected and noticed significant memory leak. After some debugging I found the leak source. It is in file clients/upsclient.c. Function upscli_connect() allocates memory for ups->pc_ctx and in case of any error, just returns -1 without freeing it. My NUT version is 2.2.0, but I quickly looked through 2.2.1 sources and it seems this bug was not fixed. So I include here simple patch. It uses goto to skip to free() allocated memory before returning in case of error. Sure one could r...
2007 Jan 23
2
Re: [nut-commits] svn commit r731
...s, *r, *rtmp; > - char *service; > + struct addrinfo hints, *res, *ai; > + char sport[NI_MAXSERV]; > #endif > > /* clear out any lingering junk */ > @@ -437,11 +438,10 @@ > ups->syserrno = 0; > ups->upsclient_magic = UPSCLIENT_MAGIC; > > - ups->pc_ctx = malloc(sizeof(PCONF_CTX)); > - > - if (!ups->pc_ctx) { > + if ((ups->pc_ctx = malloc(sizeof(PCONF_CTX))) == NULL) > + { > ups->upserror = UPSCLI_ERR_NOMEM; > - return -1; > + return -1; > } > > pconf_init(ups->pc_ctx, NULL); > @@ -449,19 +...