diff --git a/plugins/blur.c b/plugins/blur.c index cf79e22..3e5ec90 100644 --- a/plugins/blur.c +++ b/plugins/blur.c @@ -2697,8 +2697,10 @@ blurInitWindow (CompPlugin *p, bw->region = NULL; bw->clip = XCreateRegion (); - if (!bw->clip) + if (!bw->clip) { + free(bw); return FALSE; + } w->privates[bs->windowPrivateIndex].ptr = bw; diff --git a/plugins/dbus.c b/plugins/dbus.c index 0a15737..e03d975 100644 --- a/plugins/dbus.c +++ b/plugins/dbus.c @@ -2153,8 +2153,10 @@ dbusUnregisterOptions (DBusConnection *connection, option = dbusGetOptionsFromPath (d, &path[3], NULL, NULL, &nOptions); - if (!option) + if (!option) { + free(path); return FALSE; + } while (nOptions--) { @@ -2164,6 +2166,7 @@ dbusUnregisterOptions (DBusConnection *connection, option++; } + free(path); return TRUE; } diff --git a/plugins/ini.c b/plugins/ini.c index 690420f..a6181b1 100644 --- a/plugins/ini.c +++ b/plugins/ini.c @@ -197,10 +197,11 @@ iniGetFileDataFromFilename (CompDisplay *d, if (!newFd) return NULL; - /* fd now contains 'prev' or NULL */ - if (fd) + /* fd is NULL here, see condition "fd" in first for-loop */ + /* if (fd) fd->next = newFd; else + */ id->fileData = newFd; newFd->prev = fd; @@ -209,11 +210,15 @@ iniGetFileDataFromFilename (CompDisplay *d, newFd->filename = strdup (filename); pluginStr = calloc (1, sizeof (char) * pluginSep + 2); - screenStr = calloc (1, sizeof (char) * (screenSep - pluginSep)); - - if (!pluginStr || !screenStr) - return NULL; + if (!pluginStr) + return NULL; + screenStr = calloc (1, sizeof (char) * (screenSep - pluginSep)); + if (!screenStr) { + free(pluginStr); + return NULL; + } + strncpy (pluginStr, filename, pluginSep + 1); strncpy (screenStr, &filename[pluginSep+2], (screenSep - pluginSep) - 1); @@ -258,7 +263,11 @@ iniOptionValueToString (CompOptionValue *value, CompOptionType type) snprintf (tmp, 10, "%s", colorToString (value->c)); break; case CompOptionTypeMatch: - snprintf (tmp, MAX_OPTION_LENGTH, "%s", matchToString (&value->match)); + { + char *s = matchToString (&value->match); + snprintf (tmp, MAX_OPTION_LENGTH, "%s", s); + free(s); + } break; default: break; @@ -314,6 +323,7 @@ iniGetFilename (CompDisplay *d, compLogMessage (d, "ini", CompLogLevelWarn, "Invalid screen number passed " \ "to iniGetFilename %d", screen); + free(screenStr); return FALSE; } snprintf (screenStr, 12, "screen%d", screen); @@ -999,8 +1009,11 @@ iniSaveOptions (CompDisplay *d, char *itemVal; strVal = malloc (sizeof(char) * stringLen); - if (!strVal) + if (!strVal) { + fclose(optionFile); + free(fullPath); return FALSE; + } strcpy (strVal, ""); firstInList = TRUE; diff --git a/plugins/wobbly.c b/plugins/wobbly.c index e8cbfe7..dfc607d 100644 --- a/plugins/wobbly.c +++ b/plugins/wobbly.c @@ -1134,8 +1134,10 @@ createModel (int x, model->numObjects = GRID_WIDTH * GRID_HEIGHT; model->objects = malloc (sizeof (Object) * model->numObjects); - if (!model->objects) + if (!model->objects) { + free(model); return 0; + } model->anchorObject = 0; model->numSprings = 0;