]> code.delx.au - spectrwm/commitdiff
Plug memory and file descriptor leak.
authorTiago Cunha <tcunha@gmx.com>
Mon, 23 Jan 2012 19:17:16 +0000 (19:17 +0000)
committerTiago Cunha <tcunha@gmx.com>
Mon, 23 Jan 2012 19:17:16 +0000 (19:17 +0000)
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

scrotwm.c

index 072e71f3061ddf5dfecd5500a479c3d3a7713867..788f839adb51f5311e38c7096391bded96d283b3 100644 (file)
--- 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;