From: Tiago Cunha Date: Mon, 23 Jan 2012 19:17:16 +0000 (+0000) Subject: Plug memory and file descriptor leak. X-Git-Url: https://jasonwoof.com/gitweb/?a=commitdiff_plain;h=8ae086989f3c71ef8fd3cf43dc0fda8c09e76493;p=spectrwm.git Plug memory and file descriptor leak. Now that asprintf(3) return value is checked in conf_load(), make the code release the memory returned by fparseln(3) and fclose(3) the configuration file FILE pointer. Style nit fixed while there. ok marco --- diff --git a/scrotwm.c b/scrotwm.c index 072e71f..788f839 100644 --- a/scrotwm.c +++ b/scrotwm.c @@ -5509,12 +5509,12 @@ conf_load(char *filename, int keymapping) goto out; } - if(asprintf(&optsub, "%.*s", wordlen, cp) == + if (asprintf(&optsub, "%.*s", wordlen, cp) == -1) { warnx("%s: line %zd: unable to allocate" "memory for selector", filename, lineno); - return (1); + goto out; } } cp += wordlen;