Skip to content

Commit

Permalink
audio/pulseaudio: new patch, revbump.
Browse files Browse the repository at this point in the history
The new patch fixes a startup failure due to improper memory handling.

Another patch has been reworked to bypass potential problems later on.
  • Loading branch information
Ionic committed Feb 12, 2017
1 parent 7324272 commit 65af687
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 6 deletions.
5 changes: 3 additions & 2 deletions audio/pulseaudio/Portfile
Expand Up @@ -9,7 +9,7 @@ PortGroup compiler_blacklist_versions 1.0

name pulseaudio
version 10.0
revision 1
revision 2
license LGPL-2.1+ AGPL-3+ MIT BSD
categories audio
maintainers ionic openmaintainer
Expand Down Expand Up @@ -77,7 +77,8 @@ patchfiles patch-man-Makefile.am.diff \
patch-src_modules_macosx_module_coreaudio_device.c-respect-PA_NAME_MAX.diff \
patch-src_daemon_default.pa.in-skip-consolekit-and-systemdlogin.diff \
patch-src_modules_macosx_module_coreaudio_detect_device.c-add-record-playback-modarg.diff \
patch-src_Makefile.am-drop-FlatCarbon-include.diff
patch-src_Makefile.am-drop-FlatCarbon-include.diff \
patch-src_modules_macosx_module_coreaudio_device.c-fix-memory-handling.diff

# reconfigure using upstream autogen.sh for intltool 0.51 compatibility
post-patch {
Expand Down
@@ -0,0 +1,45 @@
--- src/modules/macosx/module-coreaudio-device.c.old 2017-02-12 05:50:46.000000000 +0100
+++ src/modules/macosx/module-coreaudio-device.c 2017-02-12 05:52:54.000000000 +0100
@@ -384,8 +384,6 @@ static int ca_sink_set_state(pa_sink *s,
static char * CFString_to_cstr(CFStringRef cfstr) {
char *ret = NULL;

- ret = false;
-
if (cfstr != NULL) {
const char *tmp = CFStringGetCStringPtr(cfstr, kCFStringEncodingUTF8);
CFIndex n = CFStringGetLength(cfstr) + 1 /* for the terminating NULL */;
@@ -415,7 +413,7 @@ static int ca_device_create_sink(pa_modu
coreaudio_sink *ca_sink;
pa_sink *sink;
unsigned int i;
- char *tmp;
+ char *tmp = NULL;
pa_strbuf *strbuf;
AudioObjectPropertyAddress property_address;
CFStringRef tmp_cfstr = NULL;
@@ -455,6 +453,7 @@ static int ca_device_create_sink(pa_modu
pa_strbuf_puts(strbuf, tmp);

pa_xfree(tmp);
+ tmp = NULL;
}

/* Clamp to PA_NAME_MAX and leave a "safety margin" for deduplication
@@ -552,7 +551,7 @@ static int ca_device_create_source(pa_mo
coreaudio_source *ca_source;
pa_source *source;
unsigned int i;
- char *tmp;
+ char *tmp = NULL;
pa_strbuf *strbuf;
AudioObjectPropertyAddress property_address;
CFStringRef tmp_cfstr = NULL;
@@ -592,6 +591,7 @@ static int ca_device_create_source(pa_mo
pa_strbuf_puts(strbuf, tmp);

pa_xfree(tmp);
+ tmp = NULL;
}

/* Clamp to PA_NAME_MAX and leave a "safety margin" for deduplication
@@ -1,5 +1,5 @@
--- src/modules/macosx/module-coreaudio-device.c.old 2016-05-03 08:17:39.000000000 +0200
+++ src/modules/macosx/module-coreaudio-device.c 2016-09-27 03:14:04.000000000 +0200
--- src/modules/macosx/module-coreaudio-device.c.old 2017-01-13 04:02:18.000000000 +0100
+++ src/modules/macosx/module-coreaudio-device.c 2017-02-12 06:03:28.000000000 +0100
@@ -43,6 +43,7 @@
#include <pulsecore/thread.h>
#include <pulsecore/thread-mq.h>
Expand All @@ -8,7 +8,7 @@

#include <CoreAudio/CoreAudio.h>
#include <CoreAudio/CoreAudioTypes.h>
@@ -452,7 +453,11 @@ static int ca_device_create_sink(pa_modu
@@ -452,7 +453,12 @@ static int ca_device_create_sink(pa_modu
pa_xfree(tmp);
}

Expand All @@ -18,10 +18,11 @@
+ tmp = pa_strbuf_to_string_free(strbuf);
+ ca_sink->name = pa_xstrndup(tmp, PA_NAME_MAX - 20);
+ pa_xfree(tmp);
+ tmp = NULL;

pa_log_debug("Stream name is >%s<", ca_sink->name);

@@ -585,7 +590,11 @@ static int ca_device_create_source(pa_mo
@@ -585,7 +591,12 @@ static int ca_device_create_source(pa_mo
pa_xfree(tmp);
}

Expand All @@ -31,6 +32,7 @@
+ tmp = pa_strbuf_to_string_free(strbuf);
+ ca_source->name = pa_xstrndup(tmp, PA_NAME_MAX - 20);
+ pa_xfree(tmp);
+ tmp = NULL;

pa_log_debug("Stream name is >%s<", ca_source->name);

0 comments on commit 65af687

Please sign in to comment.