Skip to content

Commit

Permalink
Sound: fix a memleak
Browse files Browse the repository at this point in the history
  • Loading branch information
CarterLi committed Jan 13, 2025
1 parent 8982b86 commit dbcd5b9
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/detection/sound/sound_linux.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ static void paSinkInfoCallback(pa_context *c, const pa_sink_info *i, int eol, vo

FFSoundDevice* device = ffListAdd(userdata);
ffStrbufInitS(&device->identifier, i->name);
ffStrbufInitS(&device->platformApi, "PulseAudio");
ffStrbufInitStatic(&device->platformApi, "PulseAudio");
ffStrbufTrimRightSpace(&device->identifier);
ffStrbufInitS(&device->name, i->description);
ffStrbufTrimRightSpace(&device->name);
Expand Down
2 changes: 2 additions & 0 deletions src/modules/sound/sound.c
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ void ffPrintSound(FFSoundOptions* options)
{
ffStrbufDestroy(&device->identifier);
ffStrbufDestroy(&device->name);
ffStrbufDestroy(&device->platformApi);
}
}

Expand Down Expand Up @@ -226,6 +227,7 @@ void ffGenerateSoundJsonResult(FF_MAYBE_UNUSED FFSoundOptions* options, yyjson_m
{
ffStrbufDestroy(&device->identifier);
ffStrbufDestroy(&device->name);
ffStrbufDestroy(&device->platformApi);
}
}

Expand Down

0 comments on commit dbcd5b9

Please sign in to comment.